[Gambas-user] Convert a "currency" string to a number
BB
adamnt42 at gmail.com
Sun Mar 26 00:10:22 CET 2023
On 26/3/23 9:33 am, Jussi Lahtinen wrote:
> I would do something like this:
> cfloat(replace(right(sTotal, -1), ",", ""))
>
> However, I do not know how much there is variation in the string
> format. You may need to use Trim() and take localization into account.
>
>
> Jussi
>
> On Sun, Mar 26, 2023 at 12:39 AM BB <adamnt42 at gmail.com
> <mailto:adamnt42 at gmail.com>> wrote:
>
> What's the best way to convert a string that looks like "$98,765" or
> "$98,765.43" to an integer / float?
>
> Or putting this another way, I want to test if the value is >
> something
> (like "sTotal > 50000"), what is the most efficient way to do this
> check.
>
> tia
>
> bruce
>
Thanks Jussi,
I was was checking that I hadn't missed something introduced in the last
years for such a conversion.
b
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230326/7c1a2caa/attachment-0001.htm>
More information about the User
mailing list