polished up a bit and got the index offset working
This commit is contained in:
Binary file not shown.
@@ -1,8 +1,11 @@
|
||||
pub fn extract_quoted(parts: &[&str]) -> Option<String> { // TODO also return a number to increment by
|
||||
pub fn extract_quoted(parts: &[&str]) -> Option<(String, usize)> {
|
||||
let mut vec_string = Vec::new();
|
||||
let mut counter: usize = 0;
|
||||
for part in parts
|
||||
{
|
||||
if part.chars().next_back().unwrap() == '"'
|
||||
counter += 1;
|
||||
// End of the string
|
||||
if part.chars().next_back().unwrap() == '"' // TODO allow for backslashes and '
|
||||
{
|
||||
vec_string.push(*part);
|
||||
let final_string: String = vec_string.join(" ");
|
||||
@@ -13,8 +16,9 @@ pub fn extract_quoted(parts: &[&str]) -> Option<String> { // TODO also return a
|
||||
final_string.chars()
|
||||
.count() - 2)
|
||||
.collect();
|
||||
return Some(final_string);
|
||||
return Some((final_string, counter));
|
||||
}
|
||||
// Otherwise just add this to the list
|
||||
else
|
||||
{
|
||||
vec_string.push(*part);
|
||||
|
||||
Reference in New Issue
Block a user