Rift
xTeam
Please! I am Ugoff ?~?
Posts: 201
|
Post by Rift on Nov 1, 2003 20:24:11 GMT -5
Does anyone have a way that they like to use to replace instances in a string.. the catch being that it doesnt depend on case sensitivity.. im having this problem br] say i want to replace the word "Cat" with "Dog".. normaly, i would use br] Replace("My Cat plays fetch","Cat","Dog") .. say i was replacing text from a text box and someone typed "My Cat plays Fetch".. in that instance the replace method would work, and Cat would become Dog.. but if that person typed "My cAt plays Fetch".. then the replace method wouldnt work.. same as if "cAt" was "CAt" etc... i was given a really helpful suggestion of first, converting the text to Ucase, or perhaps Lcase, and then using the replace method.. that works wonderful, but my problem is, when i convert from Dog back into Cat.. it's all upercase, so it looks nothing like what the person typed.. i wish i could make more sense sometimes.. lol hope someone understands.. im just trying to figure out a way to make a non-casesensitive replace method :/ -Rift-
|
|
Rift
xTeam
Please! I am Ugoff ?~?
Posts: 201
|
Post by Rift on Nov 1, 2003 21:23:28 GMT -5
never mind.. add three more commas.. and vbTextCompare and voila.. for anyone else who may need it in the future.. here's an example
Replace("my cat is fat.","Cat","Dog", , , vbTextCompare)
that will replace "cat" no matter what the case is on it.. so far -Rift-
|
|
Tewl
xTeam
C# & VB Developer
Posts: 495
|
Post by Tewl on Nov 4, 2003 11:35:49 GMT -5
Option Explicit Option Compare Text
|
|