Packagesekati.utils
Classpublic class StringUtil

Static class wrapping various String utilities.



Public Methods
 MethodDefined by
  
StringUtil Static Constructor
StringUtil
  
beginsWith(input:String, prefix:String):Boolean
[static] Determines whether the specified string begins with the spcified prefix.
StringUtil
  
commaFormatNumber(inNum:Object):String
[static] format a number with commas - ie.
StringUtil
  
detectBr(str:String):Boolean
[static] Detect HTML line breaks.
StringUtil
  
endsWith(input:String, suffix:String):Boolean
[static] Determines whether the specified string ends with the spcified suffix.
StringUtil
  
equals(s1:String, s2:String, caseSensitive:Boolean = false):Boolean
[static] Does a case insensitive compare or two strings and returns true if they are equal.
StringUtil
  
firstToUpper(str:String):String
[static] Capitalize the first character in the string.
StringUtil
  
floatToString(n:Number):String
[static] Remove scientific notation from very small floats when casting to String.
StringUtil
  
htmlDecode(s:String):String
[static] Decode HTML.
StringUtil
  
htmlEncode(s:String):String
[static] Encode HTML.
StringUtil
  
ltrim(str:String = null):String
[static] Removes whitespace from the front of the specified string.
StringUtil
  
padZeroOnFloat(n:Number):String
[static] Add zero in front of floated number.
StringUtil
  
randChar(amount:Number):String
[static] Generate a set of random characters.
StringUtil
  
randLowerChar(amount:Number):String
[static] Generate a set of random LowerCase characters.
StringUtil
  
randNum(amount:Number):String
[static] Generate a set of random Number characters.
StringUtil
  
randSpecialChar(amount:Number):String
[static] Generate a set of random Special and Number characters.
StringUtil
  
remove(str:String, key:String):String
[static] Removes all instances of the key from string.
StringUtil
  
removeSpaces(str:String):String
[static] Remove spaces from string.
StringUtil
  
removeTabs(str:String):String
[static] Remove tabs from string.
StringUtil
  
replace(str:String, oldChar:String, newChar:String):String
[static] replace every instance of a string with something else
StringUtil
  
rtrim(str:String = null):String
[static] Removes whitespace from the end of a string.
StringUtil
  
sanitizeNull(str:String):String
[static] Sanitize null strings for display purposes.
StringUtil
  
search(str:String, key:String, caseSensitive:Boolean = true):Boolean
[static] Search for key in string.
StringUtil
  
stripTags(str:String):String
[static] Strip HTML markup tags.
StringUtil
  
stripZeroAndRepairFloat(n:Number):String
[static] Strip the zero off floated numbers and remove Scientific Notation.
StringUtil
  
stripZeroOnFloat(n:Number):String
[static] Strip the zero off floated numbers.
StringUtil
  
toDoubleQuote(str:String):String
[static] Convert single quotes to double quotes.
StringUtil
  
toNumeric(str:String):String
[static] Remove all formatting and return cleaned numbers from string.
StringUtil
  
toSingleQuote(str:String):String
[static] Convert double quotes to single quotes.
StringUtil
  
toTitleCase(str:String):String
[static] Transforms source String to per word capitalization.
StringUtil
  
trim(str:String = null):String
[static] Remove leading & trailing white space.
StringUtil
  
trimCamel(str:String = null):String
[static] Trim spaces and camel notate String.
StringUtil
  
xtrim(str:String = null):String
[static] Extreme Trim: remove whitespace, line feeds, carrige returns from string
StringUtil
Public Constants
 ConstantDefined by
  LTRIM_EXP : RegExp
[static]
StringUtil
  RTRIM_EXP : RegExp
[static]
StringUtil
Constructor detail
StringUtil()constructor
public function StringUtil()

StringUtil Static Constructor

Method detail
beginsWith()method
public static function beginsWith(input:String, prefix:String):Boolean

Determines whether the specified string begins with the spcified prefix.

Parameters
input:String — The string that the prefix will be checked against.
 
prefix:String — The prefix that will be tested against the string.

Returns
Boolean — True if the string starts with the prefix, false if it does not.
commaFormatNumber()method 
public static function commaFormatNumber(inNum:Object):String

format a number with commas - ie. 10000 -> 10,000

Parameters
inNum:Object — (Object) String or Number

Returns
String
detectBr()method 
public static function detectBr(str:String):Boolean

Detect HTML line breaks.

Parameters
str:String

Returns
Boolean
endsWith()method 
public static function endsWith(input:String, suffix:String):Boolean

Determines whether the specified string ends with the spcified suffix.

Parameters
input:String — The string that the suffic will be checked against.
 
suffix:String — The suffic that will be tested against the string.

Returns
Boolean — True if the string ends with the suffix, false if it does not
equals()method 
public static function equals(s1:String, s2:String, caseSensitive:Boolean = false):Boolean

Does a case insensitive compare or two strings and returns true if they are equal.

Parameters
s1:String
 
s2:String
 
caseSensitive:Boolean (default = false)

Returns
Boolean
firstToUpper()method 
public static function firstToUpper(str:String):String

Capitalize the first character in the string.

Parameters
str:String

Returns
String
floatToString()method 
public static function floatToString(n:Number):String

Remove scientific notation from very small floats when casting to String.

Parameters
n:Number

Returns
String

Example
    trace( String(0.0000001) );   // returns 1e-7
    trace( floatToString(0.0000001) );  // returns .00000001
   

htmlDecode()method 
public static function htmlDecode(s:String):String

Decode HTML.

Parameters
s:String

Returns
String
htmlEncode()method 
public static function htmlEncode(s:String):String

Encode HTML.

Parameters
s:String

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

Removes whitespace from the front of the specified string.

Parameters
str:String (default = null)

Returns
String
padZeroOnFloat()method 
public static function padZeroOnFloat(n:Number):String

Add zero in front of floated number.

Parameters
n:Number

Returns
String
randChar()method 
public static function randChar(amount:Number):String

Generate a set of random characters.

Parameters
amount:Number

Returns
String
randLowerChar()method 
public static function randLowerChar(amount:Number):String

Generate a set of random LowerCase characters.

Parameters
amount:Number

Returns
String
randNum()method 
public static function randNum(amount:Number):String

Generate a set of random Number characters.

Parameters
amount:Number

Returns
String
randSpecialChar()method 
public static function randSpecialChar(amount:Number):String

Generate a set of random Special and Number characters.

Parameters
amount:Number

Returns
String
remove()method 
public static function remove(str:String, key:String):String

Removes all instances of the key from string.

Parameters
str:String
 
key:String

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

Remove spaces from string.

Parameters
str:String — (String)

Returns
String — String
removeTabs()method 
public static function removeTabs(str:String):String

Remove tabs from string.

Parameters
str:String

Returns
String
replace()method 
public static function replace(str:String, oldChar:String, newChar:String):String

replace every instance of a string with something else

Parameters
str:String
 
oldChar:String
 
newChar:String

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

Removes whitespace from the end of a string.

Parameters
str:String (default = null)

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

Sanitize null strings for display purposes.

Parameters
str:String

Returns
String
search()method 
public static function search(str:String, key:String, caseSensitive:Boolean = true):Boolean

Search for key in string.

Parameters
str:String
 
key:String
 
caseSensitive:Boolean (default = true)

Returns
Boolean
stripTags()method 
public static function stripTags(str:String):String

Strip HTML markup tags.

Parameters
str:String

Returns
String
stripZeroAndRepairFloat()method 
public static function stripZeroAndRepairFloat(n:Number):String

Strip the zero off floated numbers and remove Scientific Notation.

Parameters
n:Number

Returns
String
stripZeroOnFloat()method 
public static function stripZeroOnFloat(n:Number):String

Strip the zero off floated numbers.

Parameters
n:Number

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

Convert single quotes to double quotes.

Parameters
str:String

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

Remove all formatting and return cleaned numbers from string.

Parameters
str:String

Returns
String

Example
 
    StringUtils.toNumeric("123-123-1234"); // returns 1221231234 
   

toSingleQuote()method 
public static function toSingleQuote(str:String):String

Convert double quotes to single quotes.

Parameters
str:String

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

Transforms source String to per word capitalization.

Parameters
str:String

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

Remove leading & trailing white space.

Parameters
str:String (default = null)

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

Trim spaces and camel notate String.

Parameters
str:String (default = null)

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

Extreme Trim: remove whitespace, line feeds, carrige returns from string

Parameters
str:String (default = null)

Returns
String
Constant detail
LTRIM_EXPconstant
public static const LTRIM_EXP:RegExp
RTRIM_EXPconstant 
public static const RTRIM_EXP:RegExp