accepted = "abcdefghijklmnopqrstruvwxyz_0123456789";
As you can see I store the information in a variable. I need then to pick out the invalid letters of a string and destroy them. This approach is far more efficient than others I have seen, some of them which use the string_replace_all function. They will have to use lot more lines than I will have to.
Now this is the code to pick out and the destroy the invalid letters:
a = 0;
while(a<string_pos("=",word)) {
if (string_pos(string_char_at(word,a),accepted)==0) {
word = string_replace_all(word,string_char_at(word,a),""
;}
a+=1;
}
Word is a variable that store the word that should be validated. I hope I needn’t to explain this anymore, but that you should understand now. I welcome you to use this script if you need to, although credits to this site is appreciated. If you like, go ahead and debate me on whether this is or is not a good solution by commenting!
Comments
Loading comments...