poking around near the end of a string

Mike Bonner bonnmike at gmail.com
Wed May 10 10:46:23 EDT 2017

if char -2 to -1 of MNOSE = "$W" should work.

LAST doesn't return a numeric value (as far as I can tell) so you can't
subtract from it, if you do you get strange results

In addition, the order matters.  You're putting the last char first, and
the second to last char last (if you were allowed to use last that way)  So
if it did work, you'd be checking W$ against $W

You could do it other ways too of course.  You could use (char
length(MNOSE) -1 of MNOSE & char length(MNOSE) of mNose)  to do the
comparison..  Note the -1 is first to keep the characters in order.

On Wed, May 10, 2017 at 8:18 AM, Richmond via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Suppose I have a string a bit like this:
> "and then the gigantic monster bit my mother on the nose $W"
> and I want to check that that string ends with "$W" . . .
> I tried this (pseudo code):
> *if the ((last char) & (last char -1)) of MNOSE = "$W"*
> and it did not work.
> Richmond.
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

More information about the Use-livecode mailing list