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;
}

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