CFLib.org – Common Function Library Project

IsAlphanumeric(str)

Last updated November 2, 2001

author

Marcus Raphelt

Version: 1 | Requires: CF5 | Library: StrLib

Description:
This function checks if the passed string is alphanumeric.

Return Values:
Returns a Boolean value.

Example:

<CFSET x="abc123">
<CFSET y="$123">

<CFOUTPUT>
Is "#x#" alphanumeric? #YesNoFormat(IsAlphanumeric(x))#<BR>
Is "#y#" alphanumeric? #YesNoFormat(IsAlphanumeric(y))#
</CFOUTPUT>

Parameters:

Name Description Required
str String you want to check. Yes

Full UDF Source:

/**
 * Checks if a string is alphanumeric
 * 
 * @param str 	 String you want to check. 
 * @return Returns a Boolean value. 
 * @author Marcus Raphelt (cflib@raphelt.de) 
 * @version 1, November 2, 2001 
 */
function IsAlphanumeric(str) {
  if (REFindNoCase("[^a-z0-9]", str) eq 0)
    return true;
  else
    return false;
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson