Skip to main content
hema.mathivathanan
September 1, 2023
Solved

Add Zeros in the string

  • September 1, 2023
  • 4 replies
  • 0 views

Hi, 

I want my alphanumeric field with the below condition.

if the text is asdf45 I want the output total as 10 digits with Zero's in the front. How can I do that?

When I try doing text(asd45,"0000000000") --> this is not considering the strings present.

Thanks!

    Best answer by hema.mathivathanan

    I used join array and repeat function and it worked

    4 replies

    hema.mathivathanan
    hema.mathivathananAuthorAnswer
    September 1, 2023

    I used join array and repeat function and it worked

    mathieud0001
    September 1, 2023

    Probably cleaner to do something with a combination of concat/stripWith/cleanWith/text.

    mathieud0001
    September 2, 2023

    a!localVariables(
      local!text: "asdf45",
      concat(
        stripwith(local!text, "0123456789"),
        text(
          cleanwith(local!text, "0123456789"),
          "0000000000"
        )
      )
    )

    January 30, 2026

    rept("0", 10-len("asdf45")) & "asdf45"