Packagecom.curlyben.utils
Classpublic class Strings

A collection of utilities to aid construction and manipulation of strings.



Public Methods
 MethodDefined by
  
PadLeft(string:String, char:String, length:uint):String
[static] Pads a string the specified number of characters, inserting the specified pad character on the left side of the input string.
Strings
  
PadRight(string:String, char:String, length:uint):String
[static] Pads a string the specified number of characters, appending the specified pad character on the right side of the input string.
Strings
  
Reverse(string:String):String
[static] Reverses a string of characters.
Strings
  
Trim(string:String, char:String):String
[static] Trims the specified character from the both ends of a string.
Strings
  
TrimEnd(string:String, char:String):String
[static] Trims the specified character from the end (right) of a string.
Strings
  
TrimStart(string:String, char:String):String
[static] Trims the specified character from the start (left) of a string.
Strings
  
UnicodeToUTF(bytes:ByteArray, offset:uint = 0, length:uint = 0xFFFFFFFF):String
[static] Converts a Unicode (16bit) string into its UTF-8 equivelent.
Strings
Method detail
PadLeft()method
public static function PadLeft(string:String, char:String, length:uint):String

Pads a string the specified number of characters, inserting the specified pad character on the left side of the input string.
If the input string is longer than the specified length the input string will be truncated.

Parameters
string:String — The string perform the padding operation on.
 
char:String — The padding character.
 
length:uint — The desired output length of the newly created string.

Returns
String — A string built from the input padding character and input string.
PadRight()method 
public static function PadRight(string:String, char:String, length:uint):String

Pads a string the specified number of characters, appending the specified pad character on the right side of the input string.
If the input string is longer than the specified length the input string will be truncated.

Parameters
string:String — The string perform the padding operation on.
 
char:String — The padding character.
 
length:uint — The desired output length of the newly created string.

Returns
String — A string built from the input padding character and input string.
Reverse()method 
public static function Reverse(string:String):String

Reverses a string of characters.

Parameters
string:String — A string to reverse.

Returns
String — A reversed copy of the input string.
Trim()method 
public static function Trim(string:String, char:String):String

Trims the specified character from the both ends of a string.

Parameters
string:String — The string on which to apply the trim.
 
char:String — The character to remove from the ends of the input string.

Returns
String — A copy of the input string with the trim character removed from the ends.
TrimEnd()method 
public static function TrimEnd(string:String, char:String):String

Trims the specified character from the end (right) of a string.

Parameters
string:String — The string on which to apply the trim.
 
char:String — The character to remove from the end of the input string.

Returns
String — A copy of the input string with the trim character removed from the end.
TrimStart()method 
public static function TrimStart(string:String, char:String):String

Trims the specified character from the start (left) of a string.

Parameters
string:String — The string on which to apply the trim.
 
char:String — The character to remove from the start of the input string.

Returns
String — A copy of the input string with the trim character removed from the start.
UnicodeToUTF()method 
public static function UnicodeToUTF(bytes:ByteArray, offset:uint = 0, length:uint = 0xFFFFFFFF):String

Converts a Unicode (16bit) string into its UTF-8 equivelent.

Parameters
bytes:ByteArray — A ByteArray containing the Unicode string.
 
offset:uint (default = 0) — The index of in the supplied ByteArray where the Unicode string begins.
 
length:uint (default = 0xFFFFFFFF) — The length of the Unicode string (in bytes) to extract, by default characters will be read until the end of the supplied ByteArray

Returns
String — A UTF-8 string representation of the input Unicode bytes.