use-revolution Digest, Vol 18, Issue 10

Cubist at aol.com Cubist at aol.com
Thu Mar 3 07:34:57 EST 2005


In a message dated 3/3/05 4:22:58 AM, use-revolution-request at lists.runrev.com 
writes:

>
>
>Message: 12
>Date: Thu, 3 Mar 2005 16:22:32 +0900
>From: "Nicolas Cueto" <nicolas_cueto at yahoo.com>
>Subject: check for alphanumeric characters
>To: "How to use Revolution" <use-revolution at lists.runrev.com>
>Message-ID: <002b01c51fc1$c48dbe60$0c01a8c0 at 890Mhz>
>Content-Type: text/plain;  charset="iso-2022-jp"
>
>Hello again,
>
>Is there a Rev function for checking whether a variable contains only
>letters and/or numbers? When using clickChunk, I want anything not a word
>to be ignored (e.g., punctuation).
    I don't think Rev has any built-in functions that will do this job, but 
you can definitely roll your own. In addition to the regex-using one that's 
already been posted to this list, you could also do something like this:

function IsAlphaNumeric DerString
  repeat for each character CC in "1234567890qwertyuiopasdfghjklzxcvbnm"
    replace CC with "" in DerString
  end repeat
  return (DerString = empty)
end IsAlphaNumeric

   The idea is to erase everything that *is* an alphanumeric character, and 
if nothing survived, the original string was indeed free of punctuation and so 
forth. I wonder how my function compares to the regex-using one, speed-wise? I 
also wonder if the relative levels of speed might be affected by the size of 
the string you're tryna check out...


More information about the Use-livecode mailing list