OzFormatTelephone(phoneNumber)
Last updated February 26, 2004
Version: 1 | Requires: CF5 | Library: StrLib
Description:
Translates a 10 digit Australian telephone/facsimile number (either in STD or Toll Free format) into an Australian formatted telephone number.
Return Values:
Returns a string.
Example:
<cfset PhoneNumber1 = "0262842727"><!--- STD (long distance) format --->
<cfset PhoneNumber2 = "1800333999"><!--- Toll Free format --->
<cfoutput>
#PhoneNumber1# = #OzFormatTelephone(PhoneNumber1)#<br>
#PhoneNumber2# = #OzFormatTelephone(PhoneNumber2)#<br>
</cfoutput>
Parameters:
Name | Description | Required |
---|---|---|
phoneNumber | Number to format. | Yes |
Full UDF Source:
/**
* Translates a 10 digit Australian telephone/facsimile number (either in STD or Toll Free format) into an Australian formatted telephone number.
*
* @param phoneNumber Number to format. (Required)
* @return Returns a string.
* @author Peter Tilbrook (peter@coldgen.com)
* @version 1, February 26, 2004
*/
function OzFormatTelephone(PhoneNumber) {
if (not isNumeric(PhoneNumber)) return "";
if (left(PhoneNumber,1) eq 0) return "(" & left(PhoneNumber, 2) & ") " & mid(PhoneNumber, 4, 4) & "-" & right(PhoneNumber, 4);
else if (left(PhoneNumber,1) neq 0) return left(PhoneNumber, 4) & "-" & mid(PhoneNumber, 3, 3) & "-" & right(PhoneNumber, 3);
return "";
}
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