• | **numbers counting up in parenthesis (expression)**
on Mar 7, 2012 at 6:06:00 pm |

Hello everybody

i m currently using an expression to have a percentage count up to a specific number. I ve got that part figured out, but i would like the percentage amount to be in between parenthesis like this : (5.07%)

here is the expression i m using. If anyone knows how i can alter it to fit my needs, that would be great.

Thanks in advance

numDecimals = 2;

commas = true;

dollarSign = true;

beginCount = 0

endCount = 5.03

dur = 4;

t = time - inPoint;

s = linear (t, 0, dur, beginCount, endCount).toFixed(numDecimals);

suffix = "";

if (s[0] == "-"){

prefix = "-";

s = s.substr(1);

}

if(dollarSign) suffix += "%";

if (commas){

decimals = "";

if (numDecimals > 0){

decimals = s.substr(-(numDecimals + 1));

s = s.substr(0,s.length - (numDecimals + 1));

}

outStr = s.substr(-s.length, (s.length-1)%3 +1);

for (i = Math.floor((s.length-1)/3); i > 0; i--){

outStr += "," + s.substr(-i*3,3);

}

outStr + decimals + suffix ;

}else{

s + suffix;

}

• | **Re: numbers counting up in parenthesis (expression)** on Mar 7, 2012 at 11:00:35 pm |

Well if no one can decipher that...arent expressions just java or something? You could try to ask over at devshed.

• | **Re: numbers counting up in parenthesis (expression)** on Mar 8, 2012 at 12:15:05 am |

numDecimals = 2;

commas = true;

dollarSign = true;

beginCount = 0

endCount = 5.03

dur = 4;

t = time - inPoint;

s = linear (t, 0, dur, beginCount, endCount).toFixed(numDecimals);

suffix = "";

if (s[0] == "-"){

prefix = "-";

s = s.substr(1);

}

if(dollarSign) suffix += "%)";

if (commas){

decimals = "";

if (numDecimals > 0){

decimals = s.substr(-(numDecimals + 1));

s = s.substr(0,s.length - (numDecimals + 1));

}

outStr = s.substr(-s.length, (s.length-1)%3 +1);

for (i = Math.floor((s.length-1)/3); i > 0; i--){

outStr += "," + s.substr(-i*3,3);

}

"(" + outStr + decimals + suffix ;

}else{

"(" + s + suffix;

}

Johnny Cuevas, Editor

Thinkck.com

"I have not failed 700 times. I have succeeded in proving that those 700 ways will not work. When I have eliminated the ways that will not work, I will find the way that will work."

---THOMAS EDISON on inventing the light bulb.

• | **Re: numbers counting up in parenthesis (expression)** on Jul 7, 2020 at 2:29:16 am |

Thank you!