Packagethanhtran.karaokeplayer.utils
Classpublic class StringUtil



Public Methods
 MethodDefined by
  
replace(src:String, from:String, to:String):String
[static] Replace all matched strings with a specific content.
StringUtil
  
replace2(source:String, findingChar:String, replaceChar:String):String
[static]
StringUtil
  
toProperCase(s:String):String
[static] Change the first character of source string to uppercase.
StringUtil
  
trim(source:String):String
[static] Remove leading and trailing spaces
StringUtil
  
trimLeft(source:String):String
[static] Remove leading spaces
StringUtil
  
trimNewLine(src:String):String
[static] Parse a text which has prefix and/or suffix
StringUtil
  
trimRight(source:String):String
[static] Remove trailing spaces
StringUtil
  
truncate(source:String, length:uint, suffix:String = "..."):String
[static] Truncate source string and attach suffix after to form a new string fit in a specific length.
StringUtil
Method detail
replace()method
public static function replace(src:String, from:String, to:String):String

Replace all matched strings with a specific content.

Parameters
src:String — Original string.
 
from:String — Pattern string needs to be replaced.
 
to:String — String is used to replace.

Returns
String
replace2()method 
public static function replace2(source:String, findingChar:String, replaceChar:String):StringParameters
source:String
 
findingChar:String
 
replaceChar:String

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

Change the first character of source string to uppercase.

Parameters
s:String — Original string.

Returns
String
trim()method 
public static function trim(source:String):String

Remove leading and trailing spaces

Parameters
source:String — String needs to be removed leading and trailing spaces.

Returns
String
trimLeft()method 
public static function trimLeft(source:String):String

Remove leading spaces

Parameters
source:String — String needs to be removed leading space.

Returns
String
trimNewLine()method 
public static function trimNewLine(src:String):String

Parse a text which has prefix and/or suffix

Parameters
src:String — the input text

Returns
String — an object whose properties contain 3 parts of the text: mainText, prefix and suffix.
If both prefix and suffix are not found, return null.
trimRight()method 
public static function trimRight(source:String):String

Remove trailing spaces

Parameters
source:String — String needs to be removed trailing space.

Returns
String
truncate()method 
public static function truncate(source:String, length:uint, suffix:String = "..."):String

Truncate source string and attach suffix after to form a new string fit in a specific length.

Parameters
source:String — Original string.
 
length:uint — The length storing enough some WORDS of source string and suffix.
 
suffix:String (default = "...") — The suffix added after truncating source string.

Returns
String