RegexReplace(Self.Text, "^0+", "", "")
You should look into the RegexReplace function. The code written above is what you set the text to in the set text action.
There is no need for a loop. No reason to check the string 1 character at a time. Regex simply looks for a sequence of characters that match the search criteria entered in the second parameter and replaces it with the value in the forth parameter. Of course you should also learn about regex but basically this is what it is looking for:
^ - This signifies that is starts at the beginning of the string. If there is a match further in the string, it won't be replaced because the match must be the first thing in the text.
0 - This is the character the regex is looking to match.
+ - The plus sign following a number or letter says to match 1 or more instances of that character. So, in the case of leading 0s, it doesn't matter if there is 1 or 100, they match and will be replaced.
Regex is an extremely powerful way to work with and manipulate text objects and can save both coding and processing time.