CFLib.org – Common Function Library Project

IsAlphabet(str)

Last updated June 21, 2002

author

Takaki Saito

Version: 1 | Requires: CF5 | Library: StrLib

Description:
This UDF confirms that a string only contains letters, spaces, and periods.

Return Values:
Returns a boolean.

Example:

<CFSET strA = "abcde">
<CFSET strB = "abc de">
<CFSET strC = "abc.de">
<CFSET strD = "abc*de">
<CFSET strE = "abc1de">
<CFOUTPUT>
#strA# --- #IsAlphabet(strA)#<BR>
#strB# --- #IsAlphabet(strB)#<BR>
#strC# --- #IsAlphabet(strC)#<BR>
#strD# --- #IsAlphabet(strD)#<BR>
#strE# --- #IsAlphabet(strE)#<BR>
</CFOUTPUT>

Parameters:

Name Description Required
str String to check. Yes

Full UDF Source:

/**
 * This UDF confirms whether a string contains only letters.
 * 
 * @param str      String to check. (Required)
 * @return Returns a boolean. 
 * @author Takaki Saito (saito@softai.co.jp) 
 * @version 1, June 21, 2002 
 */
function IsAlphabet(str) {
    return not reFindNoCase("[^a-z\.[:space:]]",str);
}

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