I want to parse a string like "ParseThis"
or "parseThis"
into a vector of strings like ["Parse", "This"]
or ["parse", "this"]
using the nom crate.
All attempts I've tried do not return the expected result. It's possible that I don't understand yet how to use all the functions in nom.
I tried:
named!(camel_case<(&str)>,
map_res!(
take_till!(is_not_uppercase),
std::str::from_utf8));
named!(p_camel_case<&[u8], Vec<&str>>,
many0!(camel_case));
But p_camel_case
just returns a Error(Many0)
for parsing a string that starts with an uppercase letter and for parsing a string that starts with a lowercase letter it returns Done
but with an empty string as a result.
How can I tell nom that I want to parse the string, separated by uppercase letters (given there can be a first uppercase or lowercase letter)?