1 Reply Latest reply on May 11, 2016 2:14 PM by try67

    removing unwanted characters from supplied data


      I have a calculation to perform with 2 pieces of client supplied data. Sometimes this data is provided as <0.1 rather than specifying 0.085 for instance.

      I have tried using variable.replace(/>/g,"") to remove the '>' character to be able to use just 0.1 as the data for calculation, but to no avail.

      Can someone help?



      var custData1 = "<0.1";

      var custData2 = "50";

      var sData = custData1.replace(/>/g,"");

      var cCalc = (sData/custData2)*100;