Using Locate to manipulate strings (OpenInsight 32-Bit)
At 19 FEB 2010 11:35:32AM Mat Kelly wrote:
I have an OI program that does something like:
myString=other data STR 233"
Call Msg("Initializing with string ":myString)
Locate "STR" In myString Setting skipPos Then
Call Msg("Found STR")
End Else
Call Msg("No STR found")
End
…to find the position of the substring in a string. This always returns "No STR found". What am I doing incorrectly in determining the position of the substring?
Thank you.
At 19 FEB 2010 11:51AM Simon Wilmot wrote:
Mat,
Locate is used to find data within delimiters, so you could use
Locate "STR" in myString using ' ' setting skipPos then/else
Alternatively, you might be better using
SkipPos=Index(myString, "STR", 1)
There are various ways of doing string manipulation …
HTH
Simon
At 19 FEB 2010 11:53AM Ray Chan wrote:
You need to include the USING statement, e.g..,
Locate "STR" in myString USING " " Setting …
HTH,
Ray Chan