Packageorg.pranaframework.utils
Classpublic class StringUtils

Contains utility methods for working with strings.



Public Methods
 MethodDefined by
  
addAt(string:String, value:int, position:*):String
[static] Adds/inserts a new string at a certain position in the source string.
StringUtils
  
fixNewlines(string:String):String
[static] Fixes double newlines in a text.
StringUtils
  
hasText(string:String):Boolean
[static] Checks if the given string has actual text.
StringUtils
  
leftTrim(string:String):String
[static] Removes all empty characters at the beginning of a string.
StringUtils
  
leftTrimForChar(string:String, char:String):String
[static] Removes all characters at the beginning of the {
StringUtils
  
leftTrimForChars(string:String, chars:String):String
[static] Removes all characters at the beginning of the {
StringUtils
  
removeAt(string:String, beginIndex:int, endIndex:int):String
[static] Removes a part of the text between 2 positions.
StringUtils
  
replaceAt(string:String, value:int, beginIndex:int, endIndex:*):String
[static] Replaces a part of the text between 2 positions.
StringUtils
  
rightTrim(string:String):String
[static] Removes all empty characters at the end of a string.
StringUtils
  
rightTrimForChar(string:String, char:String):String
[static] Removes all characters at the end of the {
StringUtils
  
rightTrimForChars(string:String, chars:String):String
[static] Removes all characters at the end of the {
StringUtils
  
trim(string:String):String
[static] Removes all empty characters at the beginning and at the end of the passed-in {
StringUtils
Method detail
addAt()method
public static function addAt(string:String, value:int, position:*):String

Adds/inserts a new string at a certain position in the source string.

Parameters
string:String
 
value:int
 
position:*

Returns
String
fixNewlines()method 
public static function fixNewlines(string:String):String

Fixes double newlines in a text.

Parameters
string:String

Returns
String
hasText()method 
public static function hasText(string:String):Boolean

Checks if the given string has actual text.

Parameters
string:String

Returns
Boolean
leftTrim()method 
public static function leftTrim(string:String):String

Removes all empty characters at the beginning of a string.

Characters that are removed: spaces {Parameters

string:String — the string to trim

Returns
String — the trimmed string
leftTrimForChar()method 
public static function leftTrimForChar(string:String, char:String):String

Removes all characters at the beginning of the {

Parameters
string:String — the string to trim
 
char:String — the character to remove

Returns
String — the trimmed string

Throws
— if you try to remove more than one character
leftTrimForChars()method 
public static function leftTrimForChars(string:String, chars:String):String

Removes all characters at the beginning of the {

Parameters
string:String — the string to trim
 
chars:String — the characters to remove from the beginning of the {

Returns
String — the trimmed string
removeAt()method 
public static function removeAt(string:String, beginIndex:int, endIndex:int):String

Removes a part of the text between 2 positions.

Parameters
string:String
 
beginIndex:int
 
endIndex:int

Returns
String
replaceAt()method 
public static function replaceAt(string:String, value:int, beginIndex:int, endIndex:*):String

Replaces a part of the text between 2 positions.

Parameters
string:String
 
value:int
 
beginIndex:int
 
endIndex:*

Returns
String
rightTrim()method 
public static function rightTrim(string:String):String

Removes all empty characters at the end of a string.

Characters that are removed: spaces {Parameters

string:String — the string to trim

Returns
String — the trimmed string
rightTrimForChar()method 
public static function rightTrimForChar(string:String, char:String):String

Removes all characters at the end of the {

Parameters
string:String — the string to trim
 
char:String — the character to remove

Returns
String — the trimmed string

Throws
— if you try to remove more than one character
rightTrimForChars()method 
public static function rightTrimForChars(string:String, chars:String):String

Removes all characters at the end of the {

Parameters
string:String — the string to trim
 
chars:String — the characters to remove from the end of the {

Returns
String — the trimmed string
trim()method 
public static function trim(string:String):String

Removes all empty characters at the beginning and at the end of the passed-in {

Parameters
string:String — the string to trim

Returns
String — the trimmed string