mirror of
https://github.com/nushell/nushell.git
synced 2024-11-21 16:03:19 +01:00
remove commas for into float/int
This commit is contained in:
parent
1bb953877e
commit
85df6dc77d
@ -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::<f64>() {
|
||||
Ok(x) => Value::float(x, head),
|
||||
Err(reason) => Value::error(
|
||||
|
@ -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),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user