Packagech.capi.utils
Classpublic class ParseUtils
InheritanceParseUtils Inheritance Object

This class contains useful methods about String parsing.



Public Methods
 MethodDefined By
  
isBoolean(str:String):Boolean
[static] Retrieves if the specified String is a valid Boolean.
ParseUtils
  
isColor(str:String):Boolean
[static] Retrieves if the specified String is a color.
ParseUtils
  
isFloat(str:String):Boolean
[static] Retrieves if the specified String is a valid Number.
ParseUtils
  
isInteger(str:String):Boolean
[static] Retrieves if the specified String is a valid Integer.
ParseUtils
  
isUnsigned(str:String):Boolean
[static] Retrieves if the specified String is a valid unsigned Integer.
ParseUtils
  
parseBoolean(str:String):Boolean
[static] Parses the specified String to a Boolean.
ParseUtils
  
parseColor(str:String):uint
[static] Parses the specified String into a color.
ParseUtils
  
parseFloat(str:String):Number
[static] Parses the specified String to a Float using the parseFloat global function.
ParseUtils
  
parseInteger(str:String, radix:int = 0):int
[static] Parses the specified String to a Integer using the parseInt global function.
ParseUtils
  
parseNumber(str:String):Number
[static] Parses the specified String to a Number using the Number global function.
ParseUtils
  
parseUnsigned(str:String):uint
[static] Parses the specified String to an unsigned Integer.
ParseUtils
Method Detail
isBoolean()method
public static function isBoolean(str:String):Boolean

Retrieves if the specified String is a valid Boolean.

A valid boolean can be the following values :

All other values are not valid values. The values are not case sensitive.

Parameters

str:String — The String to check.

Returns
Booleantrue if the String is a valid Boolean.
isColor()method 
public static function isColor(str:String):Boolean

Retrieves if the specified String is a color. A color is defined by its RGB value, beginning with a '0x' or a '#' (0xFFFAAA or #FFFAAA).

Parameters

str:String — The String to test.

Returns
Booleantrue if the String can be parsed as color.
isFloat()method 
public static function isFloat(str:String):Boolean

Retrieves if the specified String is a valid Number.

A valid Number can be one of the following :

Parameters

str:String — The String to check.

Returns
Booleantrue if the String is a valid Number.
isInteger()method 
public static function isInteger(str:String):Boolean

Retrieves if the specified String is a valid Integer. A valid Integer can end with a dot (10.).

Parameters

str:String — The String to check.

Returns
Booleantrue if the String is a valid Integer.
isUnsigned()method 
public static function isUnsigned(str:String):Boolean

Retrieves if the specified String is a valid unsigned Integer. A valid unsigned Integer can end with a dot (10.).

Parameters

str:String — The String to check.

Returns
Booleantrue if the String is a valid unsigned Integer.
parseBoolean()method 
public static function parseBoolean(str:String):Boolean

Parses the specified String to a Boolean.

Here are the allowed values :

All other values are not valid values. The values are not case sensitive.

Parameters

str:String — The String to parse.

Returns
Boolean — A uint.

Throws
ch.capi.errors:ParseError If — the specified String is not a valid Boolean.

See also

parseColor()method 
public static function parseColor(str:String):uint

Parses the specified String into a color.

Parameters

str:String — The String to parse.

Returns
uint — A uint representing the color.

Throws
ch.capi.errors:ParseError If — the specified String is not a valid color.

See also

parseFloat()method 
public static function parseFloat(str:String):Number

Parses the specified String to a Float using the parseFloat global function.

Parameters

str:String — The String to parse.

Returns
Number — A Number.

Throws
ch.capi.errors:ParseError If — the specified String is not a valid Number.

See also

parseInteger()method 
public static function parseInteger(str:String, radix:int = 0):int

Parses the specified String to a Integer using the parseInt global function.

Parameters

str:String — The String to parse.
 
radix:int (default = 0) — The base for the attribute parsing.

Returns
int — A int.

Throws
ch.capi.errors:ParseError If — the specified String is not a valid Integer.

See also

parseNumber()method 
public static function parseNumber(str:String):Number

Parses the specified String to a Number using the Number global function. This method doesn't perform any verification and just use the global Number parse function.

Parameters

str:String — The String to parse.

Returns
Number — A Number.
parseUnsigned()method 
public static function parseUnsigned(str:String):uint

Parses the specified String to an unsigned Integer.

Parameters

str:String — The String to parse.

Returns
uint — A uint.

Throws
ch.capi.errors:ParseError If — the specified String is not a valid unsigned Integer.

See also