[Gambas-user] Convert a "currency" string to a number
Bruce Steers
bsteers4 at gmail.com
Sun Mar 26 18:00:39 CEST 2023
On Sat, 25 Mar 2023 at 22:39, BB <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
>
What about
Print GetFloat("$98,765.43")
Public Sub GetFloat(sVal As String) As Float
Return CFloat(Split(st, "£$,").Join(""))
End
Respects
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230326/3baabd71/attachment.htm>
More information about the User
mailing list