On 24/08/14 18:19, JB wrote:
Hi Richmond,
Wouldn’t that just delete the last char? I need to
check for all characters in the first string to see if
they all exist in the same order of the last chars
of the second string. I know I could use a repeat
to see if the characters all exist and then if they
do I could use a repeat that many times to delete
the last character. I was thinking there might be
a faster or at least smaller way to write the code.
Would a regex be better and if so how do you
write the regex properly?
John Balgenorth
If you have a string that is like this: ZZXYQPSPTABC
and you want to delete any occurrences of A, B, or C you could do this
sort of thing:
Well; to make things easier for myself (i.e. so I had visual
confirmation of things) I made
a stack with a fld "TEXXT" and a Button "DO IT BABY".
I put "ZZXYQPSPTABC" into fld "TEXXT"
I put this script in button "DO IT BABY":
on mouseUp
put fld "TEXXT" into TEXXT
put the number of chars in TEXXT into CHNMB
repeat CHNMB times
if the last char of TEXXT is "A" then
delete the last char of TEXXT
end if
if the last char of TEXXT is "B" then
delete the last char of TEXXT
end if
if the last char of TEXXT is "C" then
delete the last char of TEXXT
end if
put TEXXT into fld "TEXXT"
end repeat
end mouseUp
try it.
Richmond.
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode