A language built for fun
This project is maintained by cometlang
inherits Iterable final
All strings are UTF-8 encoded
left_trim()
returns a new string with all whitespace characters from the left of the string removedright_trim()
returns a new string with all whitespace characters from the right of the string removedtrim()
returns a new string with all whitespace characters from the left and right sides removedsplit(str)
returns a List of the string portions in between any instances of str
replace(value, replacement)
returns a new string with all instances of value
replaced by replacement
starts_with?(value)
returns true
if the string begins exactly with value, otherwise false
ends_with?(value)
returns true
if the string ends exactly with value, otherwise false
to_lower()
returns a new string with all uppercase letters replaced with their lowercase counterpartsto_upper()
returns a new string with all lowercase letters replaced with their uppercase counterpartsto_string()
returns selfvalue()
returns the numerical value of the string. e.g. 'a'.value()
returns 97
substring(start, [length])
returns the substring starting at the (zero-based) index of the codepoint of either the length specified or to the end of the stringlength()
returns the number of codepoints (~letters) in the string.count()
alias of length()number?()
returns true if the string only contains characters that can be parsed into a single numberwhitespace?()
returns true if the string only contains whitespace charactersformat(msg, ...)
formats a string, replacing instances of {n}
with the nth (zero-based) index of
argument after msg. e.g. String.format('this is {0} string with {0} replacement', 'a')
results in
'this is a string with a replacement'
a {
or }
can be escaped by doubling them up. e.g. String.format('this is 0 string with {0} replacement', a)
results in 'this is {0} string with a replacement'
==
compares if the two strings are equal in a case-sensitive manner+
concatenates an object (calling its to_string()
method) onto this string, returning a new String. The existing string is left unchanged[]
gets the character (codepoint) at the given index, returned as a new string