Split Char From Str
A small utility to split a string into the first or last character (type char) and the rest (type &str)
Usage
Function call
use split_first_char;
let = split_first_char.unwrap;
assert_eq!;
assert_eq!;
use split_last_char;
let = split_last_char.unwrap;
assert_eq!;
assert_eq!;
Method call
use SplitCharFromStr;
let = "abc".split_first_char.unwrap;
assert_eq!;
assert_eq!;
use SplitCharFromStr;
let = "abc".split_last_char.unwrap;
assert_eq!;
assert_eq!;
Alternative
If you don't need the first character to be a char, just use str.split_at(1), it will return a tuple of 2 strings.