2

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

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

1 Answer 1

3

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .