Anyone know how to get instring to find two stars?
x short
code
x= instring(’**’, ‘blah blah hey wait **Yes’)
x = 0 at this point.
Thanks
Anyone know how to get instring to find two stars?
x short
code
x= instring(’**’, ‘blah blah hey wait **Yes’)
x = 0 at this point.
Thanks
x= instring(’**’, ‘blah blah hey wait **Yes’,1,1)
Unfortunately, if your search string is greater than 1 character you need to specify the step. For some unknown reason the default step is the length of the search string.
When code does not work right a good first step is to carefully read the Help. Usually parameters are documented pretty well. Step is omittable but I often will add “,1” just to be explicit.
Not that you asked … AFAIK if you use a Negative Step of -1 you must specify the 4th parameter “Start” as the end of the string or it will not work. IIRC it used to be limited to 255, that may have been fixed.
ExePath=COMMAND('0')
BS=INSTRING('\',ExePath,-1,SIZE(ExePath))
ExePath=SUB(ExePath,1,BS) & PdfHelpFileName
Sean setup a website with the help which is nice when you are on your phone and curious. I can edit it if you see something missing
http://clarion.help/doku.php?id=instring_return_substring_position_.htm
yes there used to be a limit of 255 chars on the substring that was searched for but that was fixed many years back.
note that with the negative step the step can only be -1 and the length of the substring can only be one character. So it is good for finding the last dot or slash in a path/filename etc.
also remember if your substring is in a string variable then clip it.