Friday, June 15, 2012

[Action Script] Ignore Case in String June,2012

I've been making a chat application that, once the user hits Enter/Return, looks at the string and matches it with a word in an array. If the word in the string is found in the array, it is ignored. If a word is not found in the array, it is added to a new array named badWords and the user cannot send the message.

If the user hits Enter/Return two more times, the message is sent, replacing each word in badWords with three hashtags.

The issue here is case sensitivity. For instance, the word "hello" is not the same as "hEllo". Meaning a user could swear by just changing the case of 1 letter. I got around this by using .toLowerCase() on the string, but I want the message to be sent in its original format, and I still want to include the hashtags.

Any ideas?

Thanks in advance,
Jacob
Ignore Case in String

Related Post



0 comments: