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