String methods
Return the same string in all uppercase characters.
string.to_uppercase() => String
// example
do val = "Where is Brian?"
do val.to_uppercase() // "WHERE IS BRIAN?"
Return the same string in all lowercase characters.
string.to_lowercase() => String
// example
do val = "Where is Brian?"
do val.to_lowercase() // "where is brian?"
Return the same string with the first letter in uppercase. The rest of the string remains unchanged.
string.capitalize() => String
// example
do val = "my name is John"
do val.capitalize() // "My name is John"
Returns a new string with both leading and trailing whitespace removed.
.trim_left()
and .trim_right()
only trim the leading and trainling whitespace respectively.do text = " Where is Brian? "
do new_text = text.trim()
say new_text // "Where is Brian?"
do new_text = text.trim_left()
say new_text // "Where is Brian? "