diff --git a/src/dart_to_csv.rs b/src/dart_to_csv.rs index a82ceb4..b51962d 100644 --- a/src/dart_to_csv.rs +++ b/src/dart_to_csv.rs @@ -21,21 +21,14 @@ fn read_file(path: String) -> Vec { let mut translations = Vec::new(); if let Ok(lines) = read_lines(path) { - let mut previous_line = String::new(); - for ip in lines.flatten() { - let start_bytes = ip.find('\'').unwrap_or(0); - let end_bytes = ip.find(".tr,").unwrap_or(ip.len()); - let mut result = (ip[start_bytes..end_bytes]).to_string(); - - if !ip.ends_with(".tr,") { - previous_line = result; + if !ip.contains("'.tr") { continue; } - if !previous_line.is_empty() && previous_line.ends_with('\'') && ip.ends_with(".tr,") { - result = previous_line.clone(); - } + let start_bytes = ip.find('\'').unwrap_or(0); + let end_bytes = ip.find("'.tr").unwrap_or(ip.len()); + let mut result = (ip[start_bytes..end_bytes]).to_string(); if result.trim().is_empty() { continue;