I am getting a field value in text format(eg :44.345). I want to use this value for division on vf page. how can i convert this to number format to be used for division

  • you can use parseInt("10") or parseFloat("10.33") – Safiya PV Apr 4 '17 at 10:30
  • does it works on VF page? – Rohit Mourya Apr 4 '17 at 10:31
  • use VALUE function. From documentation- Converts a text string to a number – Raul Apr 4 '17 at 10:31
  • @RohitMourya you asking parseInt("10") or parseFloat("10.33") is working in vf? yes it works. – Safiya PV Apr 4 '17 at 10:41

For converting the text to number in Visualforce merge fields, you can use VALUE function in merge fields

If you have property with name division, you can use following code for Visualforce:

{!VALUE(division) * 2}

For better control, do conversion in apex or JavaScript.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.