Trait components::engine::d2::util::StringExtensions
source · [−]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>(&self, str: S) -> u32
where
S: Into<String>;
fn substitute(&self, values: Vec<String, Global>) -> 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