diff --git a/crates/nu-command/src/conversions/into/float.rs b/crates/nu-command/src/conversions/into/float.rs index 94eea96116..9bad07aeb5 100644 --- a/crates/nu-command/src/conversions/into/float.rs +++ b/crates/nu-command/src/conversions/into/float.rs @@ -96,6 +96,10 @@ fn action(input: &Value, _args: &CellPathOnlyArgs, head: Span) -> Value { Value::String { val: s, .. } => { let other = s.trim(); + // NOTE: this assumes US style commas in values + // and needs to be updated to respect locale + let other = other.replace(',', ""); + match other.parse::() { Ok(x) => Value::float(x, head), Err(reason) => Value::error( diff --git a/crates/nu-command/src/conversions/into/int.rs b/crates/nu-command/src/conversions/into/int.rs index 8a48f301c5..13bc8c732d 100644 --- a/crates/nu-command/src/conversions/into/int.rs +++ b/crates/nu-command/src/conversions/into/int.rs @@ -262,7 +262,11 @@ fn action(input: &Value, args: &Arguments, span: Span) -> Value { ), Value::String { val, .. } => { if radix == 10 { - match int_from_string(val, span) { + // NOTE: this assumes US style commas in values + // and needs to be updated to respect locale + let val = val.replace(',', ""); + + match int_from_string(&val, span) { Ok(val) => Value::int(val, span), Err(error) => Value::error(error, span), }