I'm guessing from your example code that you need to use REFind[NoCase]().
An RE is much more efficient in terms of programming time, readability, and
execution efficiency than a set of nested loops. My example lets you know if
there are any characters besides A-Z and 0-9, case insensitive. The "^" at
the beginning of the RE means, "not any of the following". If the parser
finds a non-compliant character it returns its position in the string. If no
offending characters are found it returns 0.

<CFIF REFindNoCase("[^A-Z0-9]", FORM.Username, 1) NEQ 0>
  ... An illegal character exists
</CFIF>

Regards,

Steve

-----Original Message-----
From: Steve Martin [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 27, 2000 1:00 PM
To: CF-Talk
Subject: RE: Find character not in a list (reverse of FindOneOf).


It's gonna be a little more extensive than that. The scenario is that we
have a variable which contains n characters and a list which contains m
elements. We need a function which returns true if one of the characters in
the string does not occur in the list. For this we will have to loop over
the string and compare each character.

<cfset stopcondition=0>
<cfloop from=1 to=Len(FORM.Username) index=i>
        <cfif not ListFind(variables.SomeList, i)>
                <cfset stopcondition=1>
                <cfbreak>
        </cfif>
</cfloop>

<cfif stopcondition>
        Do your stuff here
</cfif>

Steve


> -----Original Message-----
> From: Deanna L. Schneider [mailto:[EMAIL PROTECTED]]
> Sent: Friday, October 27, 2000 15:03
> To: CF-Talk
> Subject: Re: Find character not in a list (reverse of FindOneOf).
>
>
> er....listfind() function I mean.
>
> -d
>
>
>
> ************************************************************
> Deanna Schneider
> Interactive Media Developer
> UWEX Cooperative Extension Electronic Publishing Group
> 103 Extension Bldg
> 432 N. Lake Street
> Madison, WI 53706
> (608) 265-7923
>
>
>
> ------------------------------------------------------------------
> ------------------------------
> Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
> or send a message with 'unsubscribe' in the body to
> [EMAIL PROTECTED]
>

----------------------------------------------------------------------------
--------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a
message with 'unsubscribe' in the body to [EMAIL PROTECTED]

------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to