ostap / comp

a tool for querying files in various formats
MIT License
43 stars 2 forks source link

parsing numbers with spaces #11

Closed julochrobak closed 11 years ago

julochrobak commented 11 years ago

Here is an example of input with three different values which contain only digits and spaces:

[ a.num + 0 | a <- [ {num: "123 456"}, {num: "123456"}, {num: " 123456"} ]]

The result of this execution is:

0
123456
0

If there is a tab-delimited file which contains this kind of strings there is no way for users to work with them as with numbers. The suggested solutions are:

ostap commented 11 years ago

I've added a replace function which takes three arguments (as in the example above) and replaces all occurrences. I don't see any disadvantages with this approach since the values with spaces are not necessarily numeric, e.g. a file might have dates in the following format "17 08 2013".