Removing leading characters

I’m receiving data with 18 characters, which includes 7 leading 0s. Would I use the Mapper to TRIM off the leading 0s? If so how would I go about this?

Thank you

Hi Matt,

you can use the expression language, specifically the replace() method to achieve this.

expression: “0000000helloworld.”.replace(/(^[0]+)/, “”)

result: helloworld.

This uses a regex to trim ALL leading zeros from your given string.

If you would like to specifically always only remove the 7 leading zeros you can use this.

expression: “0000000helloworld.”.replace(“0000000”, “”)

result: helloworld.

which specifically removes the first 7 zeros found in the string, in this case the 7 leading zeros your looking to remove.

here is documentation in case you want to refer to it:
https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1439357/String+Functions+and+Properties#StringFunctionsandProperties-replace

Thank you cjhoward18!

This did the job perfectly.