Trait stringzilla::StringZilla
source · pub trait StringZilla<N>{
// Required methods
fn sz_find(&self, needle: N) -> Option<usize>;
fn sz_rfind(&self, needle: N) -> Option<usize>;
fn sz_find_char_from(&self, needles: N) -> Option<usize>;
fn sz_rfind_char_from(&self, needles: N) -> Option<usize>;
fn sz_find_char_not_from(&self, needles: N) -> Option<usize>;
fn sz_rfind_char_not_from(&self, needles: N) -> Option<usize>;
fn sz_edit_distance(&self, needle: N) -> usize;
fn sz_alignment_score(
&self,
needle: N,
matrix: [[i8; 256]; 256],
gap: i8
) -> isize;
}Expand description
The StringZilla trait provides a collection of string searching and manipulation functionalities.
Required Methods§
sourcefn sz_find(&self, needle: N) -> Option<usize>
fn sz_find(&self, needle: N) -> Option<usize>
Locates first matching substring. Equivalent to memmem(haystack, h_length, needle, n_length) in LibC. Similar
to strstr(haystack, needle) in LibC, but requires known length.
sourcefn sz_find_char_from(&self, needles: N) -> Option<usize>
fn sz_find_char_from(&self, needles: N) -> Option<usize>
Finds the first character in the haystack, that is present in the needle.
sourcefn sz_rfind_char_from(&self, needles: N) -> Option<usize>
fn sz_rfind_char_from(&self, needles: N) -> Option<usize>
Finds the last character in the haystack, that is present in the needle.
sourcefn sz_find_char_not_from(&self, needles: N) -> Option<usize>
fn sz_find_char_not_from(&self, needles: N) -> Option<usize>
Finds the first character in the haystack, that is not present in the needle.
sourcefn sz_rfind_char_not_from(&self, needles: N) -> Option<usize>
fn sz_rfind_char_not_from(&self, needles: N) -> Option<usize>
Finds the last character in the haystack, that is not present in the needle.
sourcefn sz_edit_distance(&self, needle: N) -> usize
fn sz_edit_distance(&self, needle: N) -> usize
Computes the Levenshtein edit-distance between two strings using the Wagner-Fisher algorithm. Similar to the Needleman-Wunsch alignment algorithm. Often used in fuzzy string matching.