1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

fix/expr: repair off-by-1 index operator error

This commit is contained in:
Roy Ivy III 2022-12-27 20:32:24 -06:00
parent be37e033be
commit fe954e5825

View file

@ -478,7 +478,7 @@ fn prefix_operator_index(values: &[String]) -> String {
for (current_idx, ch_h) in haystack.chars().enumerate() { for (current_idx, ch_h) in haystack.chars().enumerate() {
for ch_n in needles.chars() { for ch_n in needles.chars() {
if ch_n == ch_h { if ch_n == ch_h {
return current_idx.to_string(); return (current_idx + 1).to_string();
} }
} }
} }