Class: Toybox.Lang.String
- Inherits:
-
Toybox.Lang.Object
Overview
String objects represent a sequence of characters, and provide methods for string operations.
Instance Method Summary collapse
-
compareTo(other as Lang.Object) as Lang.Number
Lexicographically compare self to some other string.
-
equals(other as Lang.Object or Null) as Lang.Boolean
Test if an Object instance is equal to another instance of an Object.
-
find(string as Lang.String) as Lang.Number or Null
Determine if the specified String exists in a String.
-
hashCode() as Lang.Number
Get a hash code value for a String.
-
length() as Lang.Number
Get the number of characters in a String.
-
substring(startIndex as Lang.Number or Null, endIndex as Lang.Number or Null) as Lang.String or Null
Create a new String that contains the contents of the current String from a start position to an end position.
-
toCharArray() as Lang.Array<Lang.Char>
Convert a String to an Array of Char objects.
-
toDouble() as Lang.Double or Null
Convert a String to a Double.
-
toFloat() as Lang.Float or Null
Convert a String to a Float.
-
toLong() as Lang.Long or Null
Convert a String to a Long.
-
toLongWithBase(base as Lang.Number) as Lang.Long or Null
Convert a String to a Long using a specified base.
-
toLower() as Lang.String
Convert a String to lowercase.
-
toNumber() as Lang.Number or Null
Convert a String to a Number.
-
toNumberWithBase(base as Lang.Number) as Lang.Number or Null
Convert a String to a Number using a specified base.
-
toString() as Lang.String
Convert a String to a String.
-
toUpper() as Lang.String
Convert a String to uppercase.
-
toUtf8Array() as Lang.Array<Lang.Number>
Convert a String to an Array of Number objects.
Instance Method Details
compareTo(other as Lang.Object) as Lang.Number
Lexicographically compare self to some other string.
equals(other as Lang.Object or Null) as Lang.Boolean
Test if an Object instance is equal to another instance of an Object.
find(string as Lang.String) as Lang.Number or Null
Determine if the specified String exists in a String.
hashCode() as Lang.Number
Get a hash code value for a String.
length() as Lang.Number
Get the number of characters in a String.
substring(startIndex as Lang.Number or Null, endIndex as Lang.Number or Null) as Lang.String or Null
Create a new String that contains the contents of the current String from a start position to an end position.
Starting with 3.3.2, passing null for startIndex
sets it to the start of the string and passing null for endIndex
sets it to the end of the string. Passing in a negative number for either startIndex
or endIndex
offsets it from the end of the string.
toCharArray() as Lang.Array<Lang.Char>
Convert a String to an Array of Char objects.
toDouble() as Lang.Double or Null
Convert a String to a Double.
If a String is in the numeric form of "123" or "123.45", convert it
to a Double. Additional characters after the detected floating point
value will be ignored. Strings that cannot be interpreted as a Double,
or whose value exceeds that which can be represented in a Double, will
result in a null
value.
toFloat() as Lang.Float or Null
Convert a String to a Float.
If a String is in the numeric form of "123" or "123.45", convert it
to a Float. Additional characters after the detected floating point
value will be ignored. Strings that cannot be interpreted as a Float,
or whose value exceeds that which can be represented in a Float, will
result in a null
value.
toLong() as Lang.Long or Null
Convert a String to a Long.
If a String is in the numeric form of "123", it can be converted to
a Long. Additional characters after the detected number value will
be ignored. Strings that cannot be interpreted as a Long, or whose
value exceeds that which can be represented in a Long, will result
in a null
value.
toLongWithBase(base as Lang.Number) as Lang.Long or Null
Convert a String to a Long using a specified base.
toLower() as Lang.String
Convert a String to lowercase.
toNumber() as Lang.Number or Null
Convert a String to a Number.
If a String is in the numeric form of "123", it can be converted to
a Number. Additional characters after the detected number value will
be ignored. Strings that cannot be interpreted as a Number, or whose
value exceeds that which can be represented in a Number, will result
in a null
value.
toNumberWithBase(base as Lang.Number) as Lang.Number or Null
Convert a String to a Number using a specified base.
toString() as Lang.String
Convert a String to a String.
toUpper() as Lang.String
Convert a String to uppercase.
toUtf8Array() as Lang.Array<Lang.Number>
Convert a String to an Array of Number objects.
Each Number represents one byte of the UTF-8 representation of the String.