Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Replace decimal zero’s with dash

  • Replace decimal zero’s with dash

  • Gerben Greuliker

    November 14, 2022 at 9:48 am

    I’ve got an expression that generates numbers to currency.
    when the amount is a round number with “,00”, is it possible to replace the zero’s with a dash?

    I’ve got the following expression working:

    v=thisComp.layer("Grocerylist#1.csv")("Data")("Outline")("KidsCost")("KidsCost 4")

    new Intl.NumberFormat('nl-NL', {

    style: 'currency',

    currency: 'EUR',

    useGrouping: true

    }).format(v);


  • Filip Vandueren

    November 14, 2022 at 10:48 am

    Dag Gerben,

    try this tweak:

    new Intl.NumberFormat('nl-NL', {
    style: 'currency',
    currency: 'EUR',
    useGrouping: true
    }).format(v).replace(/00$/gi,"—");

    Don’t worry about the $, in this case it doesn’t mean a dollar, but 00 “at the end of a string”, so € 100,00 doesn’t become 1–,–.

    just using .replace(“,00”, “,–”) could work too actually.

  • Gerben Greuliker

    November 16, 2022 at 8:39 am

    He Filip,

    Thnx again!
    In the meanwhile I did find the ‘replace’ function but dit not know where to place it in the expression. Now when I see it it makes total sense 😄.

    As a sidenote: the top expression works, the bottom version not.

    Response is:

    Error: Syntaxerror: Invalid or unexpected token

    The second quotation mark after the zero is blue. Adding a space doesn’t solve it.

    Gr G

  • Filip Vandueren

    November 16, 2022 at 2:16 pm

    Yes, I didn’t put that in a code-block, so the wordpress layouter changed the quotes to curly brackets, this gives an error when copy-pasting…

    This is what it could have been:

    new Intl.NumberFormat('nl-NL', {
    style: 'currency',
    currency: 'EUR',
    useGrouping: true
    }).format(v).replace(",00",",—");
Viewing 1 - 4 of 4 posts

Log in to reply.

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