Checking a textField against a list of permitted characters

Want to talk about something that isn't covered by another category?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9389
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Checking a textField against a list of permitted characters

Post by richmond62 » Mon Feb 17, 2014 10:29 pm

This stack contains 3 fields: fORIGIN, fLIST and fOUTPUT

fLIST contains the list of permitted characters (in this case the consonants of the English alphabet).

The button will "bite" the first character from the string in fld fORIGIN and if it matches one of the letters in fld fLIST put it into fld 'fOUTPUT

This is horribly primitive and needs a REPEAT loop, but it proves its point.
LC_gadfly.png

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9389
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Checking a textField against a list of permitted charact

Post by richmond62 » Wed Feb 19, 2014 5:08 pm

Here's a cleaned-up version, with a repeat loop.

There is an option to perform using fields

and

an option to use strings (which should, with great long strings be quicker).
Attachments
char_limiter.livecode.zip
Newer version.
(15.39 KiB) Downloaded 201 times

Post Reply

Return to “Off-Topic”