Forum Replies Created

  • Awesomefighter Toons

    October 27, 2015 at 3:05 am in reply to: Expressions: Leading zeros and decimal places.

    Hi everyone! If you’ve stumbled upon this post and found the previous expressions don;t work then use this modified one. There was a slight typo in the last post which breaks the expression.

    nums= PICKWHIP VALUE ;
    amtOfZeroes= 10 ;
    numOfDecimals= 3 ;

    //------------------------------------------------------------ ;

    nums = nums.value.toFixed(numOfDecimals);

    isNeg = false;
    if (nums < 0)
    {
    nums = Math.abs(nums);
    nums = nums.toFixed(numOfDecimals);
    isNeg = true;
    }
    numsArray = nums.split(".");
    numsFloat = numsArray[0];
    while (numsFloat.length < amtOfZeroes)
    {
    numsFloat = "0" + numsFloat;
    }
    if(isNeg)
    {
    numsFloat = "-" + "0" + numsFloat;
    }

    numsFloat + "." + numsArray[1]

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy