Jump to content

convert values above 1000


 Share

Recommended Posts

Good afternoon, someone could help me?

I'm trying to do one function, to eliminate points of values above 1000

eg

U$ 1352,00

to

U$ 1352,00

could someone help me please?

I was thinking of comparing the number of characters, and if larger than 11, use a stringleft and stringright and put them together, but I think there's an easier way to do ... if they can help me, I would greatly appreciate it!

thanks

Link to comment
Share on other sites

Func MakeLessThan1000($money)
    $values = StringRegExp($money, "^U\$ (\d+),(\d\d)$", 1)
    If @error Then Return $money ; doesn't match for some reason...
    $number = $values[0]
    While $number >= 1000
        $number -= 1000
    WEnd
    Return "U$ " & $number & "," & $values[1]
EndFunc

Wrote this up quickly. Haven't tested it. Give it the whole string of "U$ 1352,00" and it will return "U$ 352,00" as long as I did it right.

Edited by Richard Robertson
Link to comment
Share on other sites

thankyou for your repply, but i'm sorry, wrong in the description

right would be:

example value:

convert this

U$ 1.352,00

to

U$ 1352,00

is basically remove the point, that's

ps: I found the edit button in the post!

Edited by golfinhu
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...