CFLib.org – Common Function Library Project

isPostalCodeBR(str)

Last updated October 06, 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;
}

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