Ken Ray wrote:
Looks good, Martin, but if the original intention is "isValid", not
"isNotValid", I'd personally remove the "double-negatives":
function isvalid mystring
return (matchtext(mystring,"^[a-zA-Z0-9_]+$"))
end isvalid
Yes Ken,
I'm not uncertain that you're not wrong :-)
Mart
On 1/25/06 11:20 AM, "Martin Baxter" <[EMAIL PROTECTED]> wrote:
> function isvalid mystring
>return not (matchtext(mystring,"[^a-zA-Z0-9_]+?"))
> end isvalid
>
> # there is a match if any character other than a-z A-Z 0-9 or _ is found
> # in mystring
> # using not inverts the result so that t
Eric Chatonet wrote:
Hi Graham,
I think that there should be also a solution using matchText :-)
Le 25 janv. 06 à 16:25, graham samuel a écrit :
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 lett
> 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 "abcdefghi
Hi Graham,
If your string is not 3000 chars long, you could just test the ASCII
code of each char:
function RightStr pStr
local tChar,tCharToNum
-
repeat for each char tChar in pStr
put charToNum(tChar) into tCharToNum
if not (tCharToNum = 95 \
or (tCharToNum >= 48 a
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. The ways
I've thought of doing it seem clunky. Basically I want to script
if myString contains only th