Hi all,
Is there any kind of built-in function that will detect the number format of an incoming string and convert it to the appropriate locale-specific format for a number?
For example, a user might enter 1.234,56 and I'd want it converted to 1,234.56. If the user enters 1,234.56 I wouldn't want to convert it. If the user enters 1.234 I'd want it converted to 1,234 (so there'd have to be a "number of decimal places" assumed or passed in as a parameter). If the user enters 1,234 I wouldn't want to convert it.
I'm working on an international site where I need some flexibility in input rules, but I have to deal with the numbers the same way regardless of input format. And, unfortunately, I have no control over the input format: the input isn't coming from a form but from a SOAP call.
If there's no built-in function (like some sort of reverse number_format() function), I can write one. I just don't want to re-invent the wheel! I haven't found anything in the docs that addresses this, but I figure 52,285 heads are better than one. 🙂
Thanks,
Rich