web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Answered

Remove Leading Zeros

(1) ShareShare
ReportReport
Posted on by 21

Hi everyone!

 

I'm looking for an expression that has the ability to look at a string and eliminate leading zeros.  0000017856 to become 17856.  Can anyone assist?

 

I greatly appreciate it!

Categories:
I have the same question (0)
  • jinivthakkar Profile Picture
    4,187 on at

    @BenderMatt please find my flow, which replaces 0 with blank values.

     

    jinivthakkar_1-1612331326656.png

    jinivthakkar_2-1612331382074.png

    jinivthakkar_3-1612331439935.png

     

    --------------------------------------------------------------------------------
    If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

  • jinivthakkar Profile Picture
    4,187 on at

    @BenderMatt There is one issue with  my solution is that if the string has 0 anywhere it will removed, so assuming that you will have first 5 characters as 0 and you only need characters after that, we can use substring which will give us correct results even if the later part of the string has 0.

     

    jinivthakkar_4-1612331786396.png

    jinivthakkar_5-1612331824733.png

    This does not remove 0 from the latter part of the string.

     

    Expression to truncate first 5 characters : 

     

    substring(variables('varZero'),5)

     

    --------------------------------------------------------------------------------
    If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

     

  • Verified answer
    VictorIvanidze Profile Picture
    13,079 on at

    Much more effective approach you'll find here.

  • BenderMatt Profile Picture
    21 on at

    Thank you all, for the help!  That got it!

     

    BenderMatt_0-1612538483550.pngBenderMatt_1-1612538551777.png

     

  • VictorIvanidze Profile Picture
    13,079 on at

    Glad to help.

  • plaridel1 Profile Picture
    36 on at

    using float() was the simplest solution that worked for me

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    does not work, for values that have zero in the value and bring characters:
    - '0000023034'
    - '0ABC0D'

    in this case how would you apply

  • VictorIvanidze Profile Picture
    13,079 on at

    Hi @Anonymous,

    did you test this

  • TimVW Profile Picture
    4 on at

    Based on this original question/answer I used a Do Until with a check using string function StartsWith: startsWith(variables('TEST'),'0') is not equal to 'true'.

    Instead of the check on: first(variables('TEST')) is not equal to 0, which only worked for removing a zero once.

    This change resulted in the desired output.

    Also, if an empty string can occur put the do until loop in a Condition checking for the string equal to '', otherwise it will fail.

     

    TimVW_0-1657637406068.png

     

     
  • DrCharlesDBA Profile Picture
    13 on at

    Good day thanks for your solution. Is there a way I can remove leading zeros without a flow?

    I am also having a similar problem. I am using a hexadecimals RFID keyboard emulator which writes to text of my PowerApps textbox. I wish to know how can I remove a leading zero. I am scanning a 7 digit barcoded RFID but it comes with a leading zero.

    Is there a way I can make the textbox ignore a leading zero on scan or keyboard number typing?
    Kindly help.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 523

#2
Valantis Profile Picture

Valantis 318

#3
David_MA Profile Picture

David_MA 235 Super User 2026 Season 1

Last 30 days Overall leaderboard