flash question (v . boring)
- Started
- Last post
- 6 Responses
- JamesEngage
Right... basically I'm using the split command to search and replace a word/phrase in a block of text... for example... if I am looking for the work 'fx' it'll make an array using fx as the way of splitting the array and then put the new word in between the array...
The trouble I have is case sensitivity if I split 'fx' it won't split 'Fx' , 'fX' or 'FX'
I could of course convert everything to lowercase... but that is a pain in the arse... and looking for a simple function or way of doing it... any help would be greatly welcome :)
- JamesEngage0
Its amazing how a Sam Adams can impair your thought process!
- rabattski0
flash doesn't have a string replace command. but you already knew that. anyways, check what byron wrote over here (hope the link works):
- JamesEngage0
cheers... still having trouble with case sensitivity :S
- murmur0
why not a simple if(string == fx|| string == fX || string == Fx || string == FX){
do something
}
- ozhanlion0
what!s wrong with instanceName.toLowerCase()
?
- JamesEngage0
coz i'm bulding a function that will remove unwanted formatting... but also will hi-light selected words... trouble with indexOf is that you don't get to see the word it has found.. so when i am hilighting it the easiest way is to insert your searchword... but if you have entered that in upper/lowers/mixed etc it either does that or it is doing it lowercase due to the check... when I want to use the original formatting of the document... therefore having to have a search and replace and hilite function work in loads of different ways...
...anyway nearly sorted now :)