Checking legality of a string

Scott Rossi scott at tactilemedia.com
Wed Jan 25 12:07:19 EST 2006


> What's the most economical way of checking that a string contains
> only certain characters? I'm just trying to check if a string
> contains letters, digits and underscores, and nothing else.

One way:

function stringCheck pString
  repeat for each char C in pString
    if C is not in "abcdefghijklmnopqrstuvwxyz1234567890_" then \
        return false
  end repeat
  return true
end stringCheck


Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com




More information about the use-livecode mailing list