Skip to content

Commit

Permalink
have only one replace_column_value in util.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
jqnatividad committed Dec 6, 2023
1 parent 8482e97 commit 4e074c9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1505,3 +1505,16 @@ pub fn process_input(
log::debug!("processed input: {:?}", processed_input);
Ok(processed_input)
}

#[inline]
pub fn replace_column_value(
record: &csv::StringRecord,
column_index: usize,
new_value: &str,
) -> csv::StringRecord {
record
.into_iter()
.enumerate()
.map(|(i, v)| if i == column_index { new_value } else { v })
.collect()
}

0 comments on commit 4e074c9

Please sign in to comment.