Jump to content

StringFormat() Currency


Recommended Posts

hi! i need to format a number from this 1254687 to this 1 254 687$, i can do this with multiple string command! but i wanna know if there a solution with the command StringFormat().

Thx in advance! :) bye bye

GreenseedMCSE+I, CCNA, A+Canada, QuebecMake Love Around You.

Link to comment
Share on other sites

You could use/modify this to do the formatting.

Func _MakeComma($Number)
    Local $_Number, $_Loop
    If $Number < 1000 Then Return $Number
    For $_Loop = 1 To Int(StringLen($Number) / 3)
        $_Number = "," & StringRight($Number, 3) & $_Number
        $Number = StringTrimRight($Number, 3)
    Next
    $_Number = StringRight($Number, 3) & $_Number
    If StringLeft($_Number, 1) = "," Then $_Number = StringTrimLeft($_Number, 1)
    Return $_Number
EndFunc  ;==>_MakeComma
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...