Class: Toybox::Lang::String
Overview
All String objects represent a sequence of characters. The String object provides methods for string operations.
Instance Method Summary
- (Boolean) equals(that) : Test if this instance is equal to another instance of an Object with equals().
- (Number) find(string) : Use find() to determine if the passed String exists in this String.
- (Number) hashCode : Use hasCode() to get a hash code value for the String.
- (Number) length : Use length() to get the number of characters in the String.
- (String) substring(startIndex, endIndex) : Use subString() to create a new String that contains the contents of the current string from start position to end position, exclusive.
- (Float) toFloat : If a string is in the numeric form of “123” or “123.45”, convert it to a Float object with toFloat().
- (String) toLower : Convert the String to lower case with toLower().
- (Number) toNumber : If a string is in numeric form, either “123” or “0x12AB”, convert it to a Number object with toNumber().
- (Object) toString : Convert to a String with toString().
- (String) toUpper : Convert the String to upper case with toUpper().
Instance Method Details
(Boolean) equals(that)
Test if this instance is equal to another instance of an Object with equals().
Parameters:
that —
That item to test against
- Returns : (Boolean) true if the objects are equal, false otherwise
- Since : 1.0.0
(Number) find(string)
Use find() to determine if the passed String exists in this String.
Parameters:
string (String) —
String to find
- Returns : (Number) index Index of the start of string or null if not found
- Since : 1.0.0
Use hasCode() to get a hash code value for the String.
Returns:
(Number) —
Hash code for the String
Since:
1.0.0
Use length() to get the number of characters in the String
Returns:
(Number) —
The length of the String
Since:
1.0.0
- (String) substring(startIndex, endIndex)
Use subString() to create a new String that contains the contents of the current string from start position to end position, exclusive.
Parameters:
startIndex (Number) —
Zero based start index of the substring
endIndex (Number) —
End position of the substring, exclusive
Returns:
(String) —
The substring of String or null on error
Since:
1.0.0
If a string is in the numeric form of “123” or “123.45”, convert it to a Float object with toFloat().
Returns:
(Float) —
A Float object, or error
Since:
1.0.0
Convert the String to lower case with toLower().
Returns:
(String) —
A new lower case String
Since:
1.0.0
If a string is in numeric form, either “123” or “0x12AB”, convert it to a Number object with toNumber().
Returns:
(Number) —
A Number object, or error
Since:
1.0.0
Convert to a String with toString().
Returns:
String representation of String
Since:
1.0.0
Convert the String to upper case with toUpper().
Returns:
(String) —
A new upper case String
Since:
1.0.0
最終更新:2016年03月02日 23:46