1use string_manipulation_utf8::CharString;
2use string_manipulation_utf8::{str_concat, str_remove, substr, substr_end, substring, substru}; fn main() {
5 let s1: &str = "0123456789";
9 let s2: String = s1.to_owned();
10
11 println!("substr: {}", substr(s1, 3, 2)); println!("substr: {}", substr(&s2, 3, 2)); println!("substr: {}", s1.substr(3, 2)); println!("substr: {}", s2.substr(3, 2)); println!("substr: {}", s2.substr(5, isize::MAX)); println!("substru: {}", substru(s1, 3, 2)); println!("substru: {}", s1.substru(3, 2)); println!("substru: {}", s2.substru(3, 2)); println!("substring: {}", substring(s1, 3, 5)); println!("substring: {}", s1.substring(3, 5)); println!("substr: {}", substr(s1, -2, 2)); println!("substr: {}", substr(s1, -10, 1)); println!("substr: {}", substr(s1, 0, 1)); println!("substr: {}", substr(s1, 6, isize::MAX)); println!("substr_end: {}", substr_end(s1, 6)); println!("substr_end: {}", s1.substr_end(6)); println!("str_remove: {}", str_remove(s1, 3, 2)); println!("str_remove: {}", s1.str_remove(3, 2)); match s1.indexof("234", 0) {
38 Some(pos) => println!("Found at position: {}", pos),
40 None => println!("Not found"),
41 }
42
43 println!("str_concat: {}", str_concat!(s1, " ", &s2)); println!("str_concat: {}", str_concat!(s1, " ", s1)); }