CFLib.org – Common Function Library Project

isPostalCodeNL(str)

Last updated October 23, 2005

author

Jorrit Janszen

Version: 1 | Requires: CF5 | Library: StrLib

Description:
Validates a dutch postal code which is formatted with four digits (first digit can't be a zero) an (optional space) and two alphas.

Return Values:
Returns a boolean.

Example:

<cfoutput>
#isPostalCodeNL(0111 AA)# (will be false)<br/>
#isPostalCodeNL(1000AA)# (will be true)<br/>
#isPostalCodeNL(9999 AA)# (will be true)<br/>
</cfoutput>

Parameters:

Name Description Required
str String to check. Yes

Full UDF Source:

/**
 * Checks if valid Dutch postal code.
 * 
 * @param str 	 String to check. (Required)
 * @return Returns a boolean. 
 * @author Jorrit Janszen (jorrit@janszen.net) 
 * @version 1, October 23, 2005 
 */
function isPostalCodeNL (str) {
	//postal codes consists of 4 digits, folowed by one space and two alphas
	return reFind("[1-9][[:digit:]]{3}[ ]?[[:alpha:]]{2}", arguments.str) gte 1;
}
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