Anyone remember how to remove zeros from in front of a number in a field. For example, I have 00012. I want 12.
I forgot the formula in the field calculator.
Don't know offhand: check here and take a look...
Is there an Arcade solution?
This thread popped up in my activity log today. You can do the same calculation in pro as I described above or use the int() function :
I guess the int() function would have worked originally too....
Thank you Joe Borgione, this is helpful and I remain grateful for your input
Used to be that we could simply multiply the text as a number by 1
so
000012 x 1 = 12
Trying to find out what this might look like today from within ArcPro is up to you
In python you can use:
!field_name!.lstrip('0')
That'll strip off any leading zeros:
I found this bit of code on the Microsoft Community page that should work in the Field Calculator using VBScript:
Assuming there is no space character in the data:
Replace( LTRIM(Replace( fieldName, "0", " ")), " ", "0")
The part in bold replace all zeros by spaces, and then, left-trim that result, ie, remove starting spaces. The external Replace replaces the spaces left in the string to their initial 0 character.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.