pub trait StringExtensions {
fn file_extension(&self) -> Option<String>;
fn remove_file_extension(&self) -> String;
fn url_extension(&self) -> Option<String>;
fn join_path(&self, relative: String) -> String;
fn hash_code<S: Into<String>>(&self, str: S) -> u32;
fn substitute(&self, values: Vec<String>) -> String;
}
Expand description
Utility mixins for Strings. Designed to be imported with ‘using’.
Required Methods
fn file_extension(&self) -> Option<String>
fn file_extension(&self) -> Option<String>
Gets the extension of a file name, or None if there is no extension
fn remove_file_extension(&self) -> String
fn remove_file_extension(&self) -> String
Returns a file name without its extension
fn url_extension(&self) -> Option<String>
fn url_extension(&self) -> Option<String>
Gets the extension of a full path or URL, with special handling for ‘/’ and ‘?’ characters. Returns None if there is no extension
fn substitute(&self, values: Vec<String>) -> String
fn substitute(&self, values: Vec<String>) -> String
Substitute all “{n}” tokens with the corresponding values.