Function whitespacesv::parse
source · pub fn parse(
source_text: &str
) -> Result<Vec<Vec<Option<Cow<'_, str>>>>, WSVError>
Expand description
Parses the contents of a .wsv (whitespace separated value) file. The result is either a 2 dimensional vec where the outer layer is the line and the inner layer is the column or a WSVError. ‘-’ values will be converted to ‘None’ and all other values will be ‘Some’
For example, given the wsv file:
1 -
3 4
the returned value would be [[Some(1), None], [Some(3), Some(4)]]
The source text will be sanitized. That is to say:
- All
"/"
escape sequences within quoted strings will be replaced with\n
inside the string. - All
""
(two double-quote character) escape sequences within strings will be replaced with"
(one double-quote character) - Any wrapping quotes around a string will be removed. Ex.
"hello world!"
will just behello world!
in the output.