Replace comma with dot in a text layer expression
Hi!
I need to do a simple counter from 0 to billions so i found this expression that works perfectly:
//begin code
startTime = 0; //seconds
endTime = 5; //seconds
beginCount = 0;
endCount = 9700698977;
hasCommas = true;
function addCommas ( s ){
if( s.length <= 3 )
return s;
else
return s.substring(0 , 3) + "," + addCommas(s.substring(3, s.length));
}
function reverse( s ){
newStr = "";
for(i = s.length-1; i >= 0; i--)
newStr += s.charAt(i)
return newStr;
}
val = Math.round (linear(time, startTime, endTime, beginCount, endCount) );
if( hasCommas )
reverse (addCommas(reverse( val + "" )))
else
val
//end code
The problem is that i need to change the commas with dots to look like 9.700.698.977, anyone know how to do it?
