Link to home
Start Free TrialLog in
Avatar of tesmc
tesmcFlag for United States of America

asked on

XJS: how do i take a currency format and append a zero if there is none

I have an element : <totalPrice>20.9</totalPrice>

I'm storing this into a variable:
var totalPrice  = node.ValueOfSelect("Info/priceInfo/totalPrice");

in another variable, i'm removing the decimal:
var Info =  totalPrice.replace( '.', '');

However, this returns 209. I want to have it append a 0 at the end so that it returns 2090

It should works as below:

i.e    20.9 --> 2090
      11.15 --> 1115
       1.13 --> 113
Avatar of Lee
Lee
Flag of United Kingdom of Great Britain and Northern Ireland image

Just multiply by 100
SOLUTION
Avatar of tesmc
tesmc
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
what about : totalPrice * 100;
Avatar of tesmc

ASKER

both ways worked well.
thanks for advice.