Skip to main content

StrExt

Trait StrExt 

Source
pub trait StrExt {
    // Required methods
    fn to_ascii_lowercase_str(&self) -> Str;
    fn to_ascii_uppercase_str(&self) -> Str;
}
Expand description

Extension trait for str to provide _str versions of methods that return an allocated String.

Required Methods§

Source

fn to_ascii_lowercase_str(&self) -> Str

Converts the string to lowercase using ASCII rules and returns a Str.

This is a _str version of str::to_ascii_lowercase.

§Examples
use omp_core::str::StrExt;

let s = "HELLO";
let string = s.to_ascii_lowercase_str();
assert_eq!(string, "hello");
Source

fn to_ascii_uppercase_str(&self) -> Str

Converts the string to uppercase using ASCII rules and returns a Str.

This is a _str version of str::to_ascii_uppercase.

§Examples
use omp_core::str::StrExt;

let s = "hello";
let string = s.to_ascii_uppercase_str();
assert_eq!(string, "HELLO");

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§