CFLib.org – Common Function Library Project

IsZipNL(str)

Last updated July 15, 2005

author

Martijn Verhoeven

Version: 2 | Requires: CF5 | Library: StrLib

Description:
Tests passed value to see if it is a properly formatted Dutch zip code. Does not check actual validity/existence of zip code!

Return Values:
Returns a Boolean value.

Example:

<cfoutput>
4808 CW: #YesNoFormat(IsZipNL("4808 CW"))#<br>
902 WS: #YesNoFormat(IsZipNL("902 WS"))#<br>
0241 WS: #YesNoFormat(IsZipNL("0241 WS"))#<br>
ARCS 14: #YesNoFormat(IsZipNL("ARCS 14"))#<br>
2345 AB: #YesNoFormat(IsZipNL("2345 AB"))#<br>
</cfoutput>

Parameters:

Name Description Required
str String to be checked. Yes

Full UDF Source:

/**
 * Tests passed value to see if it is a properly formatted Dutch zip code.
 * Thanks to Jeff Guillaume on who's UDF IsZip I based this UDF.
 * Version 2 by pjf@maestropublishing.com
 * 
 * @param str      String to be checked. (Required)
 * @return Returns a Boolean value. 
 * @author Martijn Verhoeven (MVerhoeven@Rhinofly.nl) 
 * @version 2, July 15, 2005 
 */
function IsZipNL(str) {
    /* All dutch zip codes contains four numbers and two letters  (NNNN AA) with an optional space for the regex. */
    /* Zips start at 1000 so if the first number is a 0 the zip is wrong. */
    return REFind("^[1-9][[:digit:]]{3}( )?[[:alpha:]]{2}$", arguments.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