Instr
BlitzPlus Forums/BlitzPlus Programming/Instr
| ||
Hi, I am developing a program that uses a significant amount of string manipulation. I frequently have to check to see if one string occurs in another. e.g. If (Instr(desc2$,"Error")<>0) Then ....... The thing is, because the original string (in this case desc2$) is created by user input, the sub string "Error" could actually be "error", "ERROR", "Error" or any combination of upper and lower case characters, and Instr appears to be case-sensitive. Now I know that I can cheat by doings something like this: temp$=upper$(desc2$) If (Instr(temp$,"ERROR")<>0) Then..... but wonder if there is a more efficient way as I have to do this a lot of times! Thanks. |
| ||
Yep, I think that I can answer my own question! The answer, or at least one answer is:If (Instr(upper$(desc$),"ERROR")<>0) Then..... works a treat, but am always willing to hear of better ways to achieve a similar thing. |