2016-05-11 11:31 GMT+03:00 Heiko Thiery <
heiko....@gmail.com>:
> You can simply replace the ',' with nothing...
>
> ${numb}= Replace String ${numberString} , ${EMPTY}
> ${numb}= Convert To Number ${numb}
The above works great if `,` is a thousands separator as at least in
the US. For example here in Finland `,` is a decimal separator,
though, and the above would yield totally wrong results. In here you
you would want to convert `,` into `.` instead.
Because handling different localized formats can be complicated, it
would actually be nice if `Convert To Number/Integer` would accept the
locale to use as an optional argument. Python's locale module makes
that possible, but that requires temporarily setting the global locale
setting that is not generally recommended [1]. If we make this
optional and document possible problems, it shouldn't be too big a
problem, though. Additionally, Robot probably should configure the
locale module to use users default locale when the program starts [2].
After that parsing numbers using the default locale would be safe.
[1]
https://docs.python.org/2/library/locale.html#background-details-hints-tips-and-caveats
[2]
https://docs.python.org/2/library/locale.html#locale.setlocale
Cheers,
.peke
--
Agile Tester/Developer/Consultant ::
http://eliga.fi
Lead Developer of Robot Framework ::
http://robotframework.org