Skip to main content
Participating Frequently
Aug 4, 2022 2:15 PM UTC
Question

want to understand the logic for below output

there is 16 digit card no which in text format like { 2567893025367892} want the output as {2567-8930-2536-7892}.

    4 replies

    csteward
    Brainy
    Aug 4, 2022 2:46 PM UTC

    Try:

    a!localVariables(
      local!cardNo: "2567893025367892",
      
      joinarray(
        a!forEach(
          items: 1+(enumerate(4)*4),
          expression: mid(local!cardNo,fv!item,4)
        ),
        "-"
      )
    )

    Participating Frequently
    Aug 4, 2022 3:20 PM UTC

    thnks alot

    csteward
    Brainy
    Aug 4, 2022 3:21 PM UTC

    No problem!  Feel free to mark this as answered if that solves your use case.

    Inspiring
    Aug 5, 2022 7:58 AM UTC

    by using text function we can achieve it. for example: text("2567893025367892","####-####-####-####")