| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!-- saved from url=(0014)about:internet --><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><link rel="stylesheet" href="../../../../style.css" type="text/css" media="screen"><link rel="stylesheet" href="../../../../print.css" type="text/css" media="print"><link rel="stylesheet" href="../../../../override.css" type="text/css"><meta name="keywords" content="PostCodeFormatter,org.apache.flex.formatters.PostCodeFormatter,formatString,formats,format"><title>org.apache.flex.formatters.PostCodeFormatter</title></head><body><script language="javascript" type="text/javascript" src="../../../../asdoc.js"></script><script language="javascript" type="text/javascript" src="../../../../help.js"></script><script language="javascript" type="text/javascript" src="../../../../cookies.js"></script><script language="javascript" type="text/javascript"><!-- |
| asdocTitle = 'PostCodeFormatter - ApacheFlex API Reference'; |
| var baseRef = '../../../../'; |
| window.onload = configPage; |
| --></script> |
| <script type="text/javascript"> |
| scrollToNameAnchor(); |
| </script><table class="titleTable" cellpadding="0" cellspacing="0" id="titleTable" style="display:none"><tr><td class="titleTableTitle" align="left">Apache Flex 4.16.1 API Reference </td><td class="titleTableTopNav" align="right"><a href="../../../../package-summary.html" onclick="loadClassListFrame('../../../../all-classes.html')">All Packages</a> | <a href="../../../../class-summary.html" onclick="loadClassListFrame('../../../../all-classes.html')">All Classes</a> | <a href="../../../../all-index-A.html" onclick="loadClassListFrame('../../../../index-list.html')">Index</a> | <a id="framesLink1" href="../../../../index.html?org/apache/flex/formatters/PostCodeFormatter.html&org/apache/flex/formatters/class-list.html">Frames</a><a id="noFramesLink1" style="display:none" href="" onclick="parent.location=document.location"> No Frames </a></td><td class="titleTableLogo" align="right" rowspan="3"><img src="../../../../images/logo.jpg" class="logoImage" alt="AdobeLogo" title="AdobeLogo"></td></tr><tr class="titleTableRow2"><td class="titleTableSubTitle" id="subTitle" align="left">PostCodeFormatter</td><td class="titleTableSubNav" id="subNav" align="right"><a href="#propertySummary">Properties</a> | <a href="#methodSummary">Methods</a></td></tr><tr class="titleTableRow3"><td colspan="3"> </td></tr></table><script language="javascript" type="text/javascript" xml:space="preserve"> |
| <!-- |
| |
| if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("PostCodeFormatter"); titleBar_setSubNav(false,true,false,false,false,false,false,false,true,false,false ,false,false,false,false,false);} |
| --> |
| </script><div xmlns:fn="http://www.w3.org/2005/xpath-functions" class="MainContent"><table class="classHeaderTable" cellpadding="0" cellspacing="0"><tr><td class="classHeaderTableLabel">Package</td><td><a href="package-detail.html" onclick="javascript:loadClassListFrame('class-list.html')">org.apache.flex.formatters</a></td></tr><tr><td class="classHeaderTableLabel">Class</td><td class="classSignature">public class PostCodeFormatter</td></tr><tr><td class="classHeaderTableLabel">Inheritance</td><td class="inheritanceList">PostCodeFormatter <img src="../../../../images/inherit-arrow.gif" title="Inheritance" alt="Inheritance" class="inheritArrow"> <a href="../../../../mx/formatters/Formatter.html">Formatter</a> <img src="../../../../images/inherit-arrow.gif" title="Inheritance" alt="Inheritance" class="inheritArrow"> Object</td></tr></table><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version : </b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version : </b></td><td>ApacheFlex 4.8</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions : </b></td><td>AIR 1.0, Flash Player 10.2</td></tr></table><p></p><p></p><p></p><p></p> |
| The PostCodeFormatter class formats a valid postcode |
| based on a user set <code>formatString</code> or |
| <code>formats</code> property. |
| |
| <p>Postcode formats consists of the letters C, N, A and spaces or hyphens |
| <ul> |
| <li>CC or C is the country code (required for some postcodes).</li> |
| <li>N is a number 0-9.</li> |
| <li>A is a letter A-Z or a-z,</li> |
| </ul> |
| </p> |
| |
| <p>Country codes one be one or two digits.</p> |
| |
| <p>For example "NNNN" is a four digit numeric postcode, "CCNNNN" is country code |
| followed by four digits and "AA NNNN" is two letters, followed by a space then |
| followed by four digits.</p> |
| |
| <p>More than one format can be specified by setting the <code>formats</code> |
| property to an array of format strings.</p> |
| |
| <p>Spaces and hypens will be added if missing to format the postcode correctly.</p> |
| |
| <p>If an error occurs, an empty String is returned and a String that |
| describes the error is saved to the <code>error</code> property. |
| The <code>error</code> property can have one of the following values: |
| <ul> |
| <li> |
| <code>"invalidFormat"</code> means the format constants an invalid |
| character.</li> |
| <li> |
| <code>"wrongFormat"</code> means the postcode has an invalid format.</li> |
| <li> |
| <code>"wrongLength"</code> means the postcode is not a valid length.</li> |
| <li> |
| <code>"invalidChar"</code> means the postcode contains an invalid |
| character.</li> |
| </ul> |
| </p> |
| |
| <p>Fullwidth numbers and letters are supported in postcodes by ignoring character |
| width via the <code>flash.globalization.Collator</code> |
| <code>equals</code> method.</p> |
| |
| <p></p><a name="mxmlSyntaxSummary"></a><span class="classHeaderTableLabel">MXML Syntax</span><span id="showMxmlLink" style="display:none"><a href="#mxmlSyntaxSummary" onclick="toggleMXMLOnly();"><img src="../../../../images/collapsed.gif" title="collapsed" alt="collapsed" class="collapsedImage">Show MXML Syntax</a><br/></span><span id="hideMxmlLink"><a href="#mxmlSyntaxSummary" onclick="toggleMXMLOnly();"><img src="../../../../images/expanded.gif" title="expanded" alt="expanded" class="expandedImage">Hide MXML Syntax</a></span><div id="mxmlSyntax" class="mxmlSyntax"> |
| |
| <p>The <code><mx:PostCodeFormatter></code> tag |
| inherits all of the tag attributes of its superclass, |
| and adds the following tag attributes:</p> |
| |
| <pre> |
| <mx:PostCodeFormatter |
| formatString="NNNNN" |
| formats="['NNNNN', 'NNNNN-NNNN']" |
| /> |
| </pre> |
| |
| </div><script language="javascript" type="text/javascript"><!-- |
| setMXMLOnly(); |
| --></script><p><span class="classHeaderTableLabel">See also</span></p><div class="seeAlso"><a href="../../../../org/apache/flex/validators/PostCodeValidator.html" target="">org.apache.flex.validators.PostCodeValidator</a></div><br/><hr></div><a name="propertySummary"></a><div class="summarySection"><div class="summaryTableTitle">Public Properties</div><div class="showHideLinks"><div id="hideInheritedProperty" class="hideInheritedProperty"><a class="showHideLink" href="#propertySummary" onclick="javascript:setInheritedVisible(false,'Property');"><img class="showHideLinkImage" src="../../../../images/expanded.gif"> Hide Inherited Public Properties</a></div><div id="showInheritedProperty" class="showInheritedProperty"><a class="showHideLink" href="#propertySummary" onclick="javascript:setInheritedVisible(true,'Property');"><img class="showHideLinkImage" src="../../../../images/collapsed.gif"> Show Inherited Public Properties</a></div></div><table cellspacing="0" cellpadding="3" class="summaryTable " id="summaryTableProperty"><tr><th> </th><th colspan="2">Property</th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class="hideInheritedProperty"><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"><img src="../../../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../../../mx/formatters/Formatter.html#defaultInvalidFormatError" class="signatureLink">defaultInvalidFormatError</a> : String<div class="summaryTableDescription">[static] |
| Error message for an invalid format string specified to the formatter.</div></td><td class="summaryTableOwnerCol"><a href="../../../../mx/formatters/Formatter.html">Formatter</a></td></tr><tr class="hideInheritedProperty"><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"><img src="../../../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../../../mx/formatters/Formatter.html#defaultInvalidValueError" class="signatureLink">defaultInvalidValueError</a> : String<div class="summaryTableDescription">[static] |
| Error messages for an invalid value specified to the formatter.</div></td><td class="summaryTableOwnerCol"><a href="../../../../mx/formatters/Formatter.html">Formatter</a></td></tr><tr class="hideInheritedProperty"><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"><img src="../../../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../../../mx/formatters/Formatter.html#error" class="signatureLink">error</a> : String<div class="summaryTableDescription"> |
| Description saved by the formatter when an error occurs.</div></td><td class="summaryTableOwnerCol"><a href="../../../../mx/formatters/Formatter.html">Formatter</a></td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><a href="#formats" class="signatureLink">formats</a> : Array<div class="summaryTableDescription"> |
| An array of format strings to format the postcode in.</div></td><td class="summaryTableOwnerCol">PostCodeFormatter</td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><a href="#formatString" class="signatureLink">formatString</a> : String<div class="summaryTableDescription"> |
| Format string to format the postcode in.</div></td><td class="summaryTableOwnerCol">PostCodeFormatter</td></tr></table></div><a name="protectedPropertySummary"></a><div class="summarySection"><div class="summaryTableTitle">Protected Properties</div><div class="showHideLinks"><div id="hideInheritedProtectedProperty" class="hideInheritedProtectedProperty"><a class="showHideLink" href="#protectedPropertySummary" onclick="javascript:setInheritedVisible(false,'ProtectedProperty');"><img class="showHideLinkImage" src="../../../../images/expanded.gif"> Hide Inherited Protected Properties</a></div><div id="showInheritedProtectedProperty" class="showInheritedProtectedProperty"><a class="showHideLink" href="#protectedPropertySummary" onclick="javascript:setInheritedVisible(true,'ProtectedProperty');"><img class="showHideLinkImage" src="../../../../images/collapsed.gif"> Show Inherited Protected Properties</a></div></div><table cellspacing="0" cellpadding="3" class="summaryTable hideInheritedProtectedProperty" id="summaryTableProtectedProperty"><tr><th> </th><th colspan="2">Property</th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class="hideInheritedProtectedProperty"><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"><img src="../../../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../../../mx/formatters/Formatter.html#resourceManager" class="signatureLink">resourceManager</a> : <a href="../../../../mx/resources/IResourceManager.html">IResourceManager</a><div class="summaryTableDescription">[read-only] |
| A reference to the object which manages |
| all of the application's localized resources.</div></td><td class="summaryTableOwnerCol"><a href="../../../../mx/formatters/Formatter.html">Formatter</a></td></tr></table></div><a name="methodSummary"></a><div class="summarySection"><div class="summaryTableTitle">Public Methods </div><table cellspacing="0" cellpadding="3" class="summaryTable " id="summaryTableMethod"><tr><th> </th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#PostCodeFormatter()" class="signatureLink">PostCodeFormatter</a>()</div><div class="summaryTableDescription"> |
| Constructor.</div></td><td class="summaryTableOwnerCol">PostCodeFormatter</td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#format()" class="signatureLink">format</a>(value:Object):String</div><div class="summaryTableDescription">[override] |
| Formats the value by using the format set in formatString |
| or formats.</div></td><td class="summaryTableOwnerCol">PostCodeFormatter</td></tr></table></div><a name="protectedMethodSummary"></a><div class="summarySection"><div class="summaryTableTitle">Protected Methods </div><div class="showHideLinks"><div id="hideInheritedProtectedMethod" class="hideInheritedProtectedMethod"><a class="showHideLink" href="#protectedMethodSummary" onclick="javascript:setInheritedVisible(false,'ProtectedMethod');"><img class="showHideLinkImage" src="../../../../images/expanded.gif"> Show Inherited Protected Methods</a></div><div id="showInheritedProtectedMethod" class="showInheritedProtectedMethod"><a class="showHideLink" href="#protectedMethodSummary" onclick="javascript:setInheritedVisible(true,'ProtectedMethod');"><img class="showHideLinkImage" src="../../../../images/collapsed.gif"> Show Inherited Protected Methods</a></div></div><table cellspacing="0" cellpadding="3" class="summaryTable hideInheritedProtectedMethod" id="summaryTableProtectedMethod"><tr><th> </th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class="hideInheritedProtectedMethod"><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"><img src="../../../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="../../../../mx/formatters/Formatter.html#resourcesChanged()" class="signatureLink">resourcesChanged</a>():void</div><div class="summaryTableDescription"> |
| This method is called when a Formatter is constructed, |
| and again whenever the ResourceManager dispatches |
| a "change" Event to indicate |
| that the localized resources have changed in some way.</div></td><td class="summaryTableOwnerCol"><a href="../../../../mx/formatters/Formatter.html">Formatter</a></td></tr></table></div><script language="javascript" type="text/javascript"><!-- |
| showHideInherited(); |
| --></script><div class="MainContent"><div class="detailSectionHeader">Property Detail</div><a name="propertyDetail"></a><a name="formats"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">formats</td><td class="detailHeaderType">property</td></tr></table><div class="detailBody"><code>formats:Array</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version : </b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version : </b></td><td>ApacheFlex 4.8</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions : </b></td><td>AIR 1.0, Flash Player 10.2</td></tr></table><p></p><p></p><p> |
| An array of format strings to format the postcode in. |
| |
| <p>Use for locales where more than one format is required. |
| eg en_UK</p> |
| |
| <p>See <code>formatString</code> for format of the format |
| strings.</p> |
| |
| </p><p> The default value is <code>[]</code>.</p><br/><span class="label"> Implementation </span><br/><code> public function get formats():Array</code><br/><code> public function set formats(value:Array):void</code><br/></div><a name="propertyDetail"></a><a name="formatString"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">formatString</td><td class="detailHeaderType">property</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code>formatString:String</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version : </b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version : </b></td><td>ApacheFlex 4.8</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions : </b></td><td>AIR 1.0, Flash Player 10.2</td></tr></table><p></p><p></p><p> |
| Format string to format the postcode in. |
| |
| <p>The format string consists of the letters C, N, A and spaces |
| or hyphens: |
| <ul> |
| <li>CC or C is country code (required for some postcodes).</li> |
| <li>N is a number 0-9.</li> |
| <li>A is a letter A-Z or a-z.</li> |
| </ul></p> |
| |
| </p><p> The default value is <code>null</code>.</p><br/><span class="label"> Implementation </span><br/><code> public function get formatString():String</code><br/><code> public function set formatString(value:String):void</code><br/></div><a name="constructorDetail"></a><div class="detailSectionHeader">Constructor Detail</div><a name="PostCodeFormatter()"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">PostCodeFormatter</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">Constructor</td></tr></table><div class="detailBody"><code>public function PostCodeFormatter()</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version : </b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version : </b></td><td>ApacheFlex 4.8</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions : </b></td><td>AIR 1.0, Flash Player 10.2</td></tr></table><p></p><p> |
| Constructor. |
| |
| </p></div><a name="methodDetail"></a><div class="detailSectionHeader">Method Detail</div><a name="format()"></a><a name="format(Object)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">format</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td></tr></table><div class="detailBody"><code>override public function format(value:Object):String</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version : </b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version : </b></td><td>ApacheFlex 4.8</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions : </b></td><td>AIR 1.0, Flash Player 10.2</td></tr></table><p></p><p></p><p> |
| Formats the value by using the format set in <code>formatString</code> |
| or <code>formats</code>. |
| |
| <p>If the value cannot be formatted this method returns an empty String |
| and write a description of the error to the <code>error</code> property.</p> |
| |
| </p><p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">value</span>:Object</code> — Value to format. |
| |
| </td></tr></table></p><p></p><span class="label">Returns</span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20"></td><td><code>String</code> — Formatted String. Empty if an error occurs. A description |
| of the error condition is written to the <code>error</code> property. |
| |
| </td></tr></table></div><br/><br/><hr><br/><p></p><center class="copyright"><footer>The Apache Software Foundation</footer><br/>Wed Nov 15 2017, 09:50 AM +01:00 </center></div></body></html><!--The Apache Software Foundation<br/>Wed Nov 15 2017, 09:50 AM +01:00 --> |