CFLib.org – Common Function Library Project

isPostalCodeBR(str)

Last updated October 6, 2005

author

Peter J. Farrell

Version: 1 | Requires: CF5 | Library: StrLib

Description:
Checks if postal code is format of Brazil. Does not check if the postal code actually exists.

Return Values:
Returns a boolean.

Example:

<cfoutput>
#isPostalCodeBR("54321-987")# (true)<br/>
#isPostalCodeBR("4321-123")# (false)<br/>
</cfoutput>

Parameters:

Name Description Required
str The string to check. Yes

Full UDF Source:

/**
 * Checks if postal code is format of Brazil.
 * 
 * @param str 	 The string to check. (Required)
 * @return Returns a boolean. 
 * @author Peter J. Farrell (pjf@maestropublishing.com) 
 * @version 1, October 6, 2005 
 */
function isPostalCodeBR(str) {
	return REFind("^[[:digit:]]{5}( |-)?[[:digit:]]{3}$", 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