-
Change Decimal Mark in Dan Ebberts’s Counter Expression
Hey folks,
I’m using Dan Ebberts’s counter expression (https://www.motionscript.com/design-guide/counter.html), but I would want to change the mark in front of the decimals from “.” to “,” which is the german way of displaying decimal numbers.
So for example 123456,789 instead of 123456.789
AE is running in english, so probably this causes the issue. It would be great if there was a solution without changing the AE language or workaround with an extra layer for the decimals…I’m very thankful for any ideas!
KonnenumDecimals = 3;
commas = true;
dollarSign = true;
beginCount = -1999;
endCount = 1999;
dur = 4;t = time - inPoint;
s = linear (t, 0, dur, beginCount, endCount).toFixed(numDecimals);prefix = "";
if (s[0] == "-"){
prefix = "-";
s = s.substr(1);
}
if(dollarSign) prefix += "$";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);
}
prefix + outStr + decimals;
}else{
prefix + s;
}