String

class StringAvailable in flash8, flash, neko, js, php, cpp, cs, javaThe basic String class. var length(default,null) : IntAvailable in cs, javaThe number of characters in the String. var length(default,null) : IntAvailable in flash8, flash, neko, js, php, cppThe number of characters in the String. function new( string : String ) : VoidAvailable in cs, javaCreates a copy from a given String. function new( string : String ) : VoidAvailable in flash8, flash, neko, js, php, cppCreates a copy from a given String. function charAt( index : Int ) : StringAvailable in cs, javaReturns the character at the given position. Returns the empty String if outside of String bounds. function charAt( index : Int ) : StringAvailable in flash8, flash, neko, js, php, cppReturns the character at the given position. Returns the empty String if outside of String bounds. function charCodeAt( index : Int ) : Null<Int>Available in cs, javaReturns the character code at the given position. Returns null if outside of String bounds. function charCodeAt( index : Int ) : Null<Int>Available in flash8, flash, neko, js, php, cppReturns the character code at the given position. Returns null if outside of String bounds. function indexOf( str : String, ?startIndex : Int ) : IntAvailable in cs, javaReturns the index of first occurence of str. Returns -1 if str is not found. The optional startIndex parameter allows you to specify at which character to start searching. The position returned is still relative to the beginning of the string. function indexOf( str : String, ?startIndex : Int ) : IntAvailable in flash8, flash, neko, js, php, cppReturns the index of first occurence of str. Returns -1 if str is not found. The optional startIndex parameter allows you to specify at which character to start searching. The position returned is still relative to the beginning of the string. function lastIndexOf( str : String, ?startIndex : Int ) : IntAvailable in cs, javaSimilar to indexOf but returns the latest index. If startIndex is specified, then the search starts at that position and works backwards. A long string will still be found if starts before startIndex, even if it extends past the startIndex. function lastIndexOf( str : String, ?startIndex : Int ) : IntAvailable in flash8, flash, neko, js, php, cppSimilar to indexOf but returns the latest index. If startIndex is specified, then the search starts at that position and works backwards. A long string will still be found if starts before startIndex, even if it extends past the startIndex. function split( delimiter : String ) : Array<String>Available in cs, javaSplit the string using the specified delimiter. function split( delimiter : String ) : Array<String>Available in flash8, flash, neko, js, php, cppSplit the string using the specified delimiter. function substr( pos : Int, ?len : Int ) : StringAvailable in cs, javaReturns a part of the String, taking len characters starting from pos. If len is not specified, it takes all the remaining characters. If "pos" is less than 0, then it is an offset from the end of the string. function substr( pos : Int, ?len : Int ) : StringAvailable in flash8, flash, neko, js, php, cppReturns a part of the String, taking len characters starting from pos. If len is not specified, it takes all the remaining characters. If "pos" is less than 0, then it is an offset from the end of the string. function substring( startIndex : Int, ?endIndex : Int ) : StringAvailable in cs, javaReturns a part of the String, taking from startIndex to endIndex - 1. If endIndex is not specified, length is used. If startIndex or endIndex is smaller than 0, than 0 is used. If startIndex > endIndex then they are swaped. function substring( startIndex : Int, ?endIndex : Int ) : StringAvailable in flash8, flash, neko, js, php, cppReturns a part of the String, taking from startIndex to endIndex - 1. If endIndex is not specified, length is used. If startIndex or endIndex is smaller than 0, than 0 is used. If startIndex > endIndex then they are swaped. function toLowerCase() : StringAvailable in cs, javaReturns an String where all characters have been lowercased. function toLowerCase() : StringAvailable in flash8, flash, neko, js, php, cppReturns an String where all characters have been lowercased. function toString() : StringAvailable in cs, javaReturns the String itself. function toString() : StringAvailable in flash8, flash, neko, js, php, cppReturns the String itself. function toUpperCase() : StringAvailable in cs, javaReturns an String where all characters have been uppercased. function toUpperCase() : StringAvailable in flash8, flash, neko, js, php, cppReturns an String where all characters have been uppercased. static function fromCharCode( code : Int ) : StringAvailable in cs, java static function fromCharCode( code : Int ) : StringAvailable in flash8, flash, neko, js, php, cpp
version #17659, modified 2013-02-25 00:00:26 by api
1 comment
  • Apr 24, 2012 at 10:50

    If you've come to Haxe from another language you might be wondering why String is missing some functions, like replace();

    However, these functions are a part of the StringTools class, and by adding "using StringTools;" to the top of your class file, your String objects will have access to all these functions, including replace(), trim(), startsWith() etc.

    You can find more information on this subject here:

    * http://haxe.org/manual/using
    * http://haxe.org/api/stringtools