Separator for digits
Expression allows you to separate long numbers any characters such as spaces or dots. Example: the number of 1000000000, using this expression will be displayed so – 1.000.000.000. Used for Source Text of the text layer linked with the Slider Control effect.
function Comma(number) { number = '' + Math.round(number); if (number.length > dig) { var mod = number.length % dig; var output = (mod > 0 ? (number.substring(0,mod)) : ''); for (i=0 ; i < Math.floor(number.length / dig); i++) { if ((mod == 0) && (i == 0)) output += number.substring(mod+ dig * i, mod + dig * i + dig); else output+= sym + number.substring(mod + dig * i, mod + dig * i + dig); } return (output); } else return number; } var num = effect("Slider Control")("Slider"); // Slider Control sym = '.'; // A symbol that will separate numbers. You can put a space wordL = "$"; // The word before the number wordR = " "; // The word after the number dig = 3; // The number of digits followed by a separator num =wordL+ Comma(num) + wordR; [num]
Recommended Posts