22620Re: StrPos returns -1 in V7pr5 instead of 0
- Apr 19, 2012I just happen to be looking at the same topic. The description in the WhatsNew file isn't exactly accurate.
1. all the old syntaxes still work.
2. The options are NOT optional. You must use either the old or the new options.
I haven't tried the regexp and wildcard versions yet, but a simple example follows:
First select some text containing spaces, then run the following clip code:
;long line follows
Note the third line, which tell you that you can have more than one of these options set, very much like the Find or Replace commands.
--- In email@example.com, "joy8388608" <mycroftj@...> wrote:
> Can someone give me an example of the new syntax for StrPos?
> Would it be ^$StrPos("x";"wxyz";I)$ ?
> If so, what about the older syntax ^$StrPos("SubStr";"Str";CaseSensitive)$ ?
> I just noticed StrPos returned 0 if no match in V6 but returns -1 if no match in V7pr5 when using the V6 syntax. Intentional? If so, why? This is going to break a few clips.
> ; Examine entire document text and look for the first TAB
> ^!Prompt StrPos returns ^$StrPos("^%TAB%";"^$GetText$";False)$
> C: Searches for whole words only.
> I: Ignores character case.
> R: Specifies that the search criteria represents a regular expression
> *: Specifies that the search criteria uses wildcards.
> A: Use to replace all matched occurrences with ^$StrReplace. When this option is not used, only the first match is replaced.
- << Previous post in topic Next post in topic >>