Packagemx.formatters
Classpublic class SwitchSymbolFormatter
InheritanceSwitchSymbolFormatter Inheritance Object

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

The SwitchSymbolFormatter class is a utility class that you can use when creating custom formatters. This class performs a substitution by replacing placeholder characters in one String with numbers from a second String.

For example, you specify the following information to the SwitchSymbolFormatter class:

Format String: "The SocialSecurity number is: ###-##-####"

Input String: "123456789"

The SwitchSymbolFormatter class parses the format String and replaces each placeholder character, by default the number character (#), with a number from the input String in the order in which the numbers are specified in the input String. You can define a different placeholder symbol by passing it to the constructor when you instantiate a SwitchSymbolFormatter object.

The output String created by the SwitchSymbolFormatter class from these two Strings is the following:

"The SocialSecurity number is: 123-45-6789"

The pattern can contain any characters as long as they are constant for all values of the numeric portion of the String. However, the value for formatting must be numeric.

The number of digits supplied in the source value must match the number of digits defined in the pattern String. This is the responsibility of the script calling the SwitchSymbolFormatter object.

See also

mx.formatters.PhoneFormatter


Public Methods
 MethodDefined By
  
SwitchSymbolFormatter(numberSymbol:String = #)
Constructor.
SwitchSymbolFormatter
  
formatValue(format:String, source:Object):String
Creates a new String by formatting the source String using the format pattern.
SwitchSymbolFormatter
Constructor Detail
SwitchSymbolFormatter()Constructor
public function SwitchSymbolFormatter(numberSymbol:String = #)

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

Constructor.

Parameters
numberSymbol:String (default = #) — Character to use as the pattern character.
Method Detail
formatValue()method
public function formatValue(format:String, source:Object):String

Language Version : ActionScript 3.0
Product Version : Flex 3
Runtime Versions : Flash Player 9, AIR 1.1

Creates a new String by formatting the source String using the format pattern.

Parameters

format:String — String that defines the user-requested pattern including.
 
source:Object — Valid number sequence (alpha characters are allowed if needed).

Returns
String — Formatted String.