toString(parseInteger($YourValue))
If we are talking about an input field, you can create an On Change flow that uses a Java Action from the Community Commons Library. The library contains several actions for padding and trimming that you can use to change the field.
If possible convert your string attribute to an integer on the domain level.
Otherwise you can use a widget like CustomString https://marketplace.mendix.com/link/component/1426 to format your string attribute in to the desired format (https://docs.mendix.com/refguide/parse-integer)