Rust
std::string::String API Reference
Rust's String — a growable, owned UTF-8 encoded string type, heap-allocated and mutable.
By EZ4Code Team
String
A UTF-8-encoded, growable string. It is the owned version of &str.
String::new() -> StringCreates a new empty String.
Returns: String
String::from(s: &str) -> StringConverts a &str into a String, copying the data.
Returns: String
s.push_str(s2: &str)Appends a given string slice onto the end of this String.
Returns: ()
s.push(ch: char)Appends the given char to the end of this String.
Returns: ()
s.len() -> usizeReturns the length of this String, in bytes, not chars or graphemes.
Returns: usize
s.as_str() -> &strExtracts a string slice containing the entire String.
Returns: &str
s.replace(from: &str, to: &str) -> StringReplaces all matches of a pattern with another string, returning a new String.
Returns: String