2014-02-22 18:49 GMT+01:00 [email protected] <[email protected]>:
> Folks:
> I think there is something weird about "offset". This occurred on version 6.5
> and now on 6.6.
>
> First off, the documents say:
>
> "the charsToSkip is a non-negative integer. If you don't specify how many
> charsToSkip, the offset function does not skip any items and starts at the
> beginning of the stringToSearch."
>
> Note the use of the word "items". Skipping characters vs skipping "items" is
> a
> different matter. In the revdocs that are online, the definition of
> "characters"
> to skip is correct.
You are right, offset() works only with characters (string)
> But, that's not the end of the story.
Offset does not appear to be working correctly anyway.
>
> If I run the script:
>
> put "abcdefgabcccablmnopoq" into theChars
> put offset("c",theChars)
>
> I get: 3, which is correct
>
> If I do:
> put "abcdefgabcccablmnopoq" into theChars
> put offset("c",theChars,3)
>
> I get 7. ??? What the heck?
well, you can see these lines being equivalent:
put "abcdefgabcccablmnopoq" into theChars
delete char 1 to 3 of theChars
put offset("c",theChars)
and you'll get 7, which is right.
and doing the same for your next example, gives
you 3 which is right too.
>
> But, if I do:
> put "abcdefgabcccablmnopoq" into theChars
> put offset("c",theChars,7)
>
> I get: 3
>
HTH,
Thierry
------------------------------------------------
Thierry Douez - http://sunny-tdz.com
Maker of sunnYperl - sunnYmidi - sunnYmage - sunnYpdf
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode