Stage 7.15: Useful String Methods
Ferris will show you some useful string methods:
"".replace(from, to)- to replace a part of a string"".len()- to get the length of a string"".pop()- remove the last character and returns it"".push_str()- append a string at the end"".trim()- remove leading and trailing whitespaces. There are also more specific trim methods"".to_lowercase()- transform all letters to lowercase"".to_uppercase()- transform all letters to uppercase"".is_empty()- returns true if the string is empty (length of zero)&""[M..N]- substrings are done with the index operator[M..N]
Further information:
