Streamline string handling.

This commit is contained in:
Stephen Chung
2021-03-24 13:17:52 +08:00
parent 3a1e93e324
commit c4fe1782df
12 changed files with 129 additions and 82 deletions

View File

@@ -21,7 +21,7 @@ fn count_string_bytes(s: &str) -> INT {
/// This version uses `ImmutableString` and `&str`.
fn find_substring(s: ImmutableString, sub: &str) -> INT {
s.as_str().find(sub).map(|x| x as INT).unwrap_or(-1)
s.find(sub).map(|x| x as INT).unwrap_or(-1)
}
fn main() -> Result<(), Box<EvalAltResult>> {