Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

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

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/53fab8317237b7af852576cf005b24ed.txt
  • Last modified: 2023/12/30 11:57
  • by 127.0.0.1