Skip to main content

StrExt

Trait StrExt 

Source
pub trait StrExt {
    // Required methods
    fn repeat(&self, times: usize) -> String;
    fn to_lowercase(&self) -> String;
    fn to_uppercase(&self) -> String;
    fn to_ascii_uppercase(&self) -> String;
    fn to_ascii_lowercase(&self) -> String;
}
Expand description

Extension trait to override methods that returns std’s String

Required Methods§

Source

fn repeat(&self, times: usize) -> String

Creates a new String by repeating a string times.

§Panics

This function will panic if the capacity would overflow.

Source

fn to_lowercase(&self) -> String

Returns the lowercase equivalent of this string slice, as a new String.

Source

fn to_uppercase(&self) -> String

Returns the uppercase equivalent of this string slice, as a new String.

Source

fn to_ascii_uppercase(&self) -> String

Returns a copy of this string where each character is mapped to its ASCII upper case equivalent.

ASCII letters ‘a’ to ‘z’ are mapped to ‘A’ to ‘Z’, but non-ASCII letters are unchanged.

Source

fn to_ascii_lowercase(&self) -> String

Returns a copy of this string where each character is mapped to its ASCII lower case equivalent.

ASCII letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’, but non-ASCII letters are unchanged.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl StrExt for str

Implementors§