Strsplit
strsplit is a crate that provides a Strsplit struct and a utility function until_char for splitting strings efficiently.
Usage
Add this to your Cargo.toml:
[]
= "0.1"
Then you can use it in your code:
use Strsplit;
let haystack = "a,b,c,d,e,f";
let letters: = new.collect;
assert_eq!;
Function: until_char
The until_char function returns the string before the first instance of the delimiter is found.
use until_char;
let haystack = "hello";
let trimmed = until_char;
assert_eq!;