Skip to content

Commit

Permalink
excel: optimize trimming
Browse files Browse the repository at this point in the history
  • Loading branch information
jqnatividad committed Jun 11, 2022
1 parent 2a70134 commit 780206a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/cmd/excel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,13 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
if args.flag_trim {
record.trim();
trimmed_record.clear();
for field in record.iter() {
record.iter().for_each(|field| {
if field.contains('\n') {
let no_newlines = field.to_string().replace('\n', " ");
trimmed_record.push_field(&no_newlines);
trimmed_record.push_field(&field.to_string().replace('\n', " "));
} else {
trimmed_record.push_field(field);
}
}
});
wtr.write_record(&trimmed_record).unwrap();
} else {
wtr.write_record(&record).unwrap();
Expand Down

0 comments on commit 780206a

Please sign in to comment.