You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
542 B
JavaScript

{
function stripCommas(string) {
return string.replace(/,/g, "");
}
function stripPeriods(string) {
return string.replace(/\./g, "");
}
}
CommaDelimitedInteger
= value:$[0-9,]+ {
return parseInt(stripCommas(value));
}
CommaDelimitedFloat
= value:$([0-9,]+ ("." [0-9]+)?) {
return parseFloat(stripCommas(value));
}
PeriodDelimitedInteger
= value:$[0-9.]+ {
return parseInt(stripPeriods(value));
}
PeriodDelimitedFloat
= value:$([0-9.]+ ("," [0-9]+)?) {
return parseFloat(stripPeriods(value).replace(/,/g, "."));
}