Forum Replies Created

  • Hey Kalle, thanks for your quick response!

    your suggestions seems to do the trick, but as it turns out I need those seperators.
    For example 123.456,78 instead of 123,456.78.

    I tried to put “s.replace(“.” , “,”)” in the original expression, but could’t get it to work.

    Buuut after doing some further online research I stumbled over this sweet piece of expression, which I find pretty versitile and fits my needs perfectly.
    Credit goes to Sébastien Lavoie at https://keyframed.tv/how-to-format-a-slider-control-value-as-money-in-after-effects/

    Thanks anyways!

    spacer = " ";
    decimal = ".";
    prefix = "$";
    suffix = "¢";

    isPrefixed = (effect("Show prefix")("Checkbox") == 1 ? prefix : "");
    isSuffixed = (effect("Show suffix")("Checkbox") == 1 ? suffix : "");
    amount = effect("Amount")("Slider");

    function convertToMoney(amount) {
    var _sign, _prefix, _suffix;
    _sign = "";
    _prefix = ((isPrefixed) ? prefix : "");
    _suffix = ((isSuffixed) ? suffix : "");

    // Removing the negative
    if (amount < 0) {
    _sign = "-";
    amount = -amount;

    }

    amount = parseFloat(amount).toFixed(2);

    amount = amount.toString().replace(/./g, function(character, index, array) {
    if(character === ".") {
    return decimal;
    } else if ((array.length - index) % 3 || index === 0) {
    return character;
    } else {
    return spacer + character;
    }
    });

    return _sign + _prefix + amount + _suffix;
    }

    convertToMoney(amount);

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