Trait ExtString

Source
pub trait ExtString {
    // Required methods
    fn reverse(&self) -> String;
    fn pad_left(&self, pad_len: usize, c: char) -> String;
    fn pad_right(&self, pad_len: usize, c: char) -> String;
    fn pad_left_str(&self, pad_len: usize, s: &str) -> String;
    fn pad_right_str(&self, pad_len: usize, s: &str) -> String;
    fn is_numeric(&self) -> bool;
    fn is_alphabetic(&self) -> bool;
    fn is_alphanumeric(&self) -> bool;
    fn swap_case(&self) -> String;
}
Expand description

The trait that adds functionality to the String struct.

Required Methods§

Source

fn reverse(&self) -> String

Reverses order of characters

Source

fn pad_left(&self, pad_len: usize, c: char) -> String

Pads the left side of a string by repeating the same character until ‘pad_len’ is reached. If pad_len is shorter or equal to the character length, a simple cloned string will be returned.

Source

fn pad_right(&self, pad_len: usize, c: char) -> String

Pads the right side of a string by repeating the same character until ‘pad_len’ is reached. If pad_len is shorter or equal to the character length, a simple cloned string will be returned.

Source

fn pad_left_str(&self, pad_len: usize, s: &str) -> String

Pads the left side of a string by repeating the same string slice until ‘pad_len’ is reached. If pad_len is shorter or equal to the character length, a simple cloned string will be returned.

Source

fn pad_right_str(&self, pad_len: usize, s: &str) -> String

Pads the right side of a string by repeating the same string slice until ‘pad_len’ is reached. If pad_len is shorter or equal to the character length, a simple cloned string will be returned.

Source

fn is_numeric(&self) -> bool

Checks that all characters in a string are numeric characters.

Source

fn is_alphabetic(&self) -> bool

Checks that all characters in a string are alphabetic characters.

Source

fn is_alphanumeric(&self) -> bool

Checks that all characters in a string are either numeric or alphabetic.

Source

fn swap_case(&self) -> String

Swaps upper case characters to lower case and vice versa.

Implementations on Foreign Types§

Source§

impl ExtString for String

Source§

fn reverse(&self) -> String

Reverses order of characters

Source§

fn pad_left(&self, pad_len: usize, c: char) -> String

Pads the left side of a string by repeating the same character until ‘pad_len’ is reached. If pad_len is shorter or equal to the character length, a simple cloned string will be returned.

Source§

fn pad_right(&self, pad_len: usize, c: char) -> String

Pads the right side of a string by repeating the same character until ‘pad_len’ is reached. If pad_len is shorter or equal to the character length, a simple cloned string will be returned.

Source§

fn is_numeric(&self) -> bool

Checks that all characters in a string are numeric characters.

Source§

fn is_alphabetic(&self) -> bool

Checks that all characters in a string are alphabetic characters.

Source§

fn pad_left_str(&self, pad_len: usize, s: &str) -> String

Source§

fn pad_right_str(&self, pad_len: usize, s: &str) -> String

Source§

fn is_alphanumeric(&self) -> bool

Source§

fn swap_case(&self) -> String

Implementors§