Class std.rt.String
Synopsis
public final class String extends Comparable< String >
Represents strings of characters.
Fields
Lower-case digits for fromInt()
.
There are 36 digits in this array, thus making the maximum radix 36.
Upper-case digits for fromInt()
.
There are 36 digits in this array, thus making the maximum radix 36.
Constructors
Methods
Make a string containing a single UTF-8 character.
Make a string from a boolean.
Arguments
value | The boolean value. |
---|
Returns
Either the string "true" or the string "false".
Make a string from a floating-point number.
Arguments
value | The value to be converted into a string. |
---|---|
minPrecision | The minimum number of digits after the demical point to display. |
maxPrecision | The mximum number of digits after the decimal point to display. |
allowExp | If true , write the number in standard form if very small. |
Returns
The resulting string.
Make a string from a floating-point number. If the number is very small, it'll be converted to standard form.
Arguments
value | The value to be converted into a string. |
---|---|
minPrecision | The minimum number of digits after the demical point to display. |
maxPrecision | The mximum number of digits after the decimal point to display. |
Returns
The resulting string.
Make a string from a floating-point number. If the number is very small, it'll be converted to standard form.
Arguments
value | The value to be converted into a string. |
---|
Returns
The resulting string.
Make a string from an integer.
Arguments
value | The number to be converted into a string. |
---|---|
radix | The radix (base) of the number system to use. |
digits | The array of digits to use. The lenght must be at least radix .
|
Make a string from an integer. If the radix is larger than 10, then lowercase letters will be used as the extra digits. The maximum radix is thus 36.
Arguments
value | The number to be converted into a string. |
---|---|
radix | The radix (base) of the number system to use. |
Make a base-10 string from an integer.
Arguments
value | The value to be converted into a string. |
---|
Make a string from an unsigned integer.
Arguments
value | The value to be converted into a string. |
---|---|
radix | The radix (base) of the number system to use. |
digits | The digits to use; the length must be at least radix .
|
Make a string from an integer. If the radix is larger than 10, then lowercase letters will be used as the extra digits. The maximum radix is thus 36.
Arguments
value | The number to be converted into a string. |
---|---|
radix | The radix (base) of the number system to use. |
Make a base-10 string from an integer.
Arguments
value | The value to be converted into a string. |
---|
Make a string from an array of bytes.
Arguments
bytes | The array of bytes. |
---|---|
offset | Offset into the array to begin copying characters from. |
count | Number of characters to copy. |
Return the size of the string.
Returns
The size of the string (in bytes).
Concatenate a string with an integer. The integer is converted to a string in base 10 before being concatenated.
Concatenate a string with an integer. The integer is converted to a string in base 10 before being concatenated.
Concatenate a string with a boolean.
Concatenate a string with a floating-point number.
Check if two strings are equal.
No description given
Compute the hash of a string.
Concatenate a string with a StringFormattable
object.
Convert the string to an array of bytes making up the string.
Convert the string to an array of bytes making up the string, NUL-terminated.
Extract a substring from this string.
Arguments
start | The starting position (zero-based) to begin extracting from. |
---|---|
size | Number of bytes to extract. |
Throws
IndexError | If the range is out of bounds. |
---|
Extract a substring from start
to the end of this string.
Arguments
start | The starting position (zero-based) to begin extracting from. |
---|
Throws
IndexError | If the starting position is out of bounds. |
---|
Find a substring inside this string, and return its offset, but only if found after start
.
Returns -1 if the string is not found.
Find a substring inside this string, and return its offset. Returns -1 if the string is not found.
Find a substring matching the specified pattern inside this string, and return its offset, but only if
found after start
. Returns -1 if the string is not found.
Find a substring matching the specified pattern inside this string. Returns -1 if not found.
Count the number of occurences of sub
within this string.
Returns true
if this string starts with prefix
.
Returns true
if this strings ends with suffix
.
Return this string, but with all occurences of search
replaced with replaceWith
.
Return this string, but with all substrings matching pat
replaced with format
,
which is a regex format string. See std.re.Match.format()
for more information.
Split the string at the specified delimiter, up to the maximum number of splits, and return an array with all tokens which were delimited by the specified delimiter in the original string. The final token contains the remainder of the string, if there were more occurences of the delimeter than the maximum.
Arguments
delimiter | The delimiter which is to split the tokens. |
---|---|
maxSplits | Maximum number of splits; the returned array will have one more elements than this number. A value of 0 indicates that there should not be any splits, and the full string is returned as the sole member of the array. Negative values indicate that there is no limit to splits. |
Returns
An array containing the delimited tokens.
Throws
std.rt.IllegalArgumentError | If delimeter is the empty string. |
---|
Split the string at the specified delimiter, up to the maximum number of splits, and return an array with all tokens which were delimited by the specified delimiter in the original string.
Arguments
delimiter | The delimiter which is to split the tokens. |
---|
Returns
An array containing the delimited tokens.
Throws
std.rt.IllegalArgumentError | If delimeter is the empty string. |
---|
Convert the string to an unsigned integer.
Convert the string to a signed integer.
Convert the string to a floating-point number, of type double
.