Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Cloud Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Cloud.
SOLVED

How do you strip leading zeros for values in a single column? i.e. 0400 -> 400, 0058 -> 58.

 
1 REPLY 1
Trifacta_Alumni
Alteryx Alumni (Retired)

Hi @Jack Roten?,

 

You can accomplish this by using the "Replace text or patterns" transformation. You can find this option by clicking on the "Replace" icon in the transformation toolbar and choosing "Text or patterns" from the drop-down list:

This will open the transform builder on the right side of the screen. Enter the name of the column that contains leading zeros in the "Column" field. In the "Find" field, paste the following pattern (including the backticks):

`{start}{[0]}+`

This pattern identifies one or more instances of "0" at the beginning of your string. You can find more information about Trifacta patterns by reading this article.

 

You can leave the "Replace with" field empty if you want to remove the leading zeros entirely. If you want to insert a new value in place of the zeros, you can enter a string value here.

 

Your screen should look like this after composing your step:

 

Let me know if this helps! If it does, please mark the answer "Best answer" so that other users know that your question has been resolved. :)