haXe API Documentation
Back | Index
class StringTools
Available in flash, neko, js, flash9, php, cpp
The StringTools class contains some extra functionalities for String manipulation. It's stored in a different class in order to prevent the standard String of being bloated and thus increasing the size of each application using it.
static function endsWith(s : String, end : String) : Bool
Tells if the string s ends with the string end.
static inline function fastCodeAt(s : String, index : Int) : Int
Provides a fast native string charCodeAt access. Since the EOF value might vary depending on the platforms, always test with StringTools.isEOF. Only guaranteed to work if index in 0,s.length range. Might not work with strings containing \0 char.
static function hex(n : Int, ?digits : Int) : String
Encode a number into a hexadecimal representation, with an optional number of zeros for left padding.
static function htmlEscape(s : String) : String
Escape HTML special characters of the string.
static function htmlUnescape(s : String) : String
Unescape HTML special characters of the string.
static inline function isEOF(c : Int) : Bool
static function isSpace(s : String, pos : Int) : Bool
Tells if the character in the string s at position pos is a space.
static function lpad(s : String, c : String, l : Int) : String
Pad the string s by appending c at its left until it reach l characters.
static function ltrim(s : String) : String
Removes spaces at the left of the String s.
static function replace(s : String, sub : String, by : String) : String
Replace all occurences of the string sub in the string s by the string by.
static function rpad(s : String, c : String, l : Int) : String
Pad the string s by appending c at its right until it reach l characters.
static function rtrim(s : String) : String
Removes spaces at the right of the String s.
static function startsWith(s : String, start : String) : Bool
Tells if the string s starts with the string start.
static function trim(s : String) : String
Removes spaces at the beginning and the end of the String s.
static function urlDecode(s : String) : String
Decode an URL using the standard format.
static function urlEncode(s : String) : String
Encode an URL by using the standard format.
Back | Index