Packagecom.apdevblog.utils
Classpublic class StringUtils
InheritanceStringUtils Inheritance Object

Language Version : ActionScript 3.0
Runtime Versions : AIR 1.0, Flash Player 9

Class with little helpers for working w/ Strings.



Public Properties
 PropertyDefined By
  LEFT : Number
[static]
StringUtils
  RIGHT : Number
[static]
StringUtils
Public Methods
 MethodDefined By
  
hexStringToInt(hex:String):int
[static] converts hexadecimal string to int.
StringUtils
  
objectToString(obj:Object):String
[static] dumps Object to String.
StringUtils
  
padString(val:String, strLength:Number, padChar:String, padDirection:Number):String
[static] Resize a given string to a greater length and fill it up with a custom character.
StringUtils
  
replace(haystack:String, needle:String, replace:String):String
[static] capitalizes first character of String.
StringUtils
  
toTitleCase(str:String):String
[static] capitalizes first character of String.
StringUtils
  
trim(str:String = null):String
[static] removes blanks at the beginning and end of a string.
StringUtils
  
ucWords(str:String):String
[static] capitalizes first character of every word in String.
StringUtils
Property Detail
LEFTproperty
public static var LEFT:Number

RIGHTproperty 
public static var RIGHT:Number

Method Detail
hexStringToInt()method
public static function hexStringToInt(hex:String):int

converts hexadecimal string to int.

Parameters

hex:String — hexadecimal String (w/ or w/o #)

Returns
int — corresponding int value
objectToString()method 
public static function objectToString(obj:Object):String

dumps Object to String.

Parameters

obj:Object — Object to be dumped

Returns
String
padString()method 
public static function padString(val:String, strLength:Number, padChar:String, padDirection:Number):String

Resize a given string to a greater length and fill it up with a custom character.

Parameters

val:String — The value that will be modified
 
strLength:Number — The length of the new string
 
padChar:String — The string will be padded with this character
 
padDirection:Number (default = NaN) — Where will the characters be added?

Returns
String
replace()method 
public static function replace(haystack:String, needle:String, replace:String):String

capitalizes first character of String.

Parameters

haystack:String — String to search in
 
needle:String — String that we are looking for
 
replace:String — If needle is found replace is with this String

Returns
String
toTitleCase()method 
public static function toTitleCase(str:String):String

capitalizes first character of String.

Parameters

str:String — String to edit

Returns
String
trim()method 
public static function trim(str:String = null):String

removes blanks at the beginning and end of a string.

Parameters

str:String (default = null) — String to be trimmed

Returns
String
ucWords()method 
public static function ucWords(str:String):String

capitalizes first character of every word in String.

Parameters

str:String — String to edit

Returns
String