polished up a bit and got the index offset working

This commit is contained in:
2026-04-30 12:42:47 +01:00
parent 660f7cad7e
commit 800bee13da
5 changed files with 84 additions and 48 deletions
Binary file not shown.
+7 -3
View File
@@ -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);