CFLib.org – Common Function Library Project

IsAlphanumeric(str)

Last updated November 02, 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;
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson