PDA

Click to See Complete Forum and Search --> : Replace statment


chenko
Jul 8th, 2001, 07:27 AM
Is there a way I can use the Replace statment so it ignores case?

CreoN
Jul 8th, 2001, 10:05 AM
Replace(lcase(sText),"text to replace","text to replace with")


That should be working just fine (if I didn't mess up the syntax :))

chenko
Jul 8th, 2001, 11:52 AM
Well If I do that then it will change all the output text to lower case :(

Psyrus
Jul 8th, 2001, 12:23 PM
You can use vbTextCompare... use a 1

Replace( strYourString, strToReplace, strReplacement, 1)

should do it...

The full syntax is:

Replace( string, stringToReplace, replacementString [, start [, count[, compare]]])



Chris

chenko
Jul 8th, 2001, 12:32 PM
I tried that and it didnt work, No error either :(

Psyrus
Jul 8th, 2001, 12:46 PM
That's strange...can you post the line that's giving you the trouble?


Chris

Psyrus
Jul 8th, 2001, 12:52 PM
Did you try:
Replace( strMyString, strToReplace, strReplacement, 0, len(strMyString), 1)


Chris

chenko
Jul 8th, 2001, 12:54 PM
Well I used


Replace( strMyString, strToReplace, strReplacement, 0, Len(strMyString), 1)

I will try yours

Psyrus
Jul 8th, 2001, 12:57 PM
That should've worked...


Chris

chenko
Jul 8th, 2001, 12:59 PM
I tired it and it didnt work, It gave me a "Object Required Error" on the same line

chenko
Jul 8th, 2001, 01:00 PM
I tired it and it didnt work, It gave me a "Object Required Error" on the same line.


you sure its supposed to be 1?

Psyrus
Jul 8th, 2001, 01:03 PM
The constant for vbTextCompare is 1


Chris

chenko
Jul 8th, 2001, 01:52 PM
Still dosent work for me :(