Jump to content
Server Maintenance This Week. ×

Script variable passed as String


This topic is 2816 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I am using a custom function to format a number into currency format ( two decimals ). 

RoundDecimals(11.0) = 11.00

The problems occurs when I use a variable:

$amount = 11.0

RoundDecimals($amount) = 11.11

Similarly, I get the same error using a string:

RoundDecimals("11.0") = 11.11

 

Is there any tricks to get around this issue ? 

This is the custom function that I used (I replaced the comma for a dot and defaulted second parameter to 2):

https://www.briandunning.com/cf/974

 

Link to comment
Share on other sites

18 minutes ago, comment said:

You should not copy and paste code from people you don't know and use it without understanding how it works.

Needing to understand how it works would defeat half the value of using someone else's code. Encapsulation is a beautiful thing.

Edited by jbante
Link to comment
Share on other sites

This topic is 2816 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.