Class containing static utility methods for dealing with strings.
public static function addSlashes(str:String):StringParameters
Returns
public static function chop(str:String):StringParameters
Returns
public static function chunkSplit(body:String, chunkLength:int = 76, end:String = "
"):String
Split a string into smaller chunks
Can be used to split a string into smaller chunks which is useful
for e.g. converting base64_encode() output to match RFC 2045
semantics. It inserts end every chunklen
characters.
Parameters
| body:String — The string to be chunked
|
| |
| chunkLength:int (default = 76) — The chunk length. Default to 76.
|
| |
| end:String (default = "
") — The line ending sequence. Defaults to "\r\n".
|
Returns
public static function countChars(str:String):Array
Return an array containing totals of each character used in a string
Counts the number of occurrences of every character, and returns
them as an array. Note that this is the same as the PHP function
count_chars() with the default mode 0 - modes are not
implemented.
Parameters
| str:String — The string to inspect for character counting
|
Returns
| Array — An associative array in which the keys are the characters
found, and the values are the number of times in which each character
was used.
|
public static function countWords(str:String):Array
Return an array containing totals of each word used in a string
Counts the number of occurrences of every word, and returns
them as an array. Inspired by PHP's count_chars(), except for words
rather than characters. I think this could be useful for writers
to make sure they don't use the same words over and over.
Note: a word is defined as any sequence of characters bounded by
regexp's \w.
Parameters
| str:String — The string to inspect for word counting
|
Returns
| Array — An associative array in which the keys are the words
found, and the values are the number of times in which each word
was used.
|
public static function isSpace(chr:String):BooleanParameters
Returns
public static function ltrim(str:String):StringParameters
Returns
public static function rtrim(str:String):StringParameters
Returns
public static function sprintf(format:String, ... args):StringParameters
Returns
public static function trim(str:String):StringParameters
Returns
public static function vsprintf(format:String, args:Array):StringParameters
Returns
public static function zerofill(num:int, decimalPlaces:int):String
Adds zeroes in front of a number
Parameters
| num:int — The number to be zero-filled.
|
| |
| decimalPlaces:int — The minimum number of characters in the
returned number-String.
|
Returns
| String — A string representation of the number, with zeroes added
to the front as padding.
|