Trim Start

I have a string

‘00050’. I need to remove all the 0’s before the 5 but keep any after. The number can come in with any number of 0’s. It could be ‘00504’ ‘051’ for example.

Any suggestions?

Thanks

1 Like

@Vicky_Fegan

Please see if this helps:

  1. Assign the string to a string variable.
  2. Declare a variable of type Int32.
  3. Add an assign activity and assign Convert.ToInt32(of the string in step 1) and assign it to the Int var created in step 2.
  4. Convert the int value in Step3 to string again.
1 Like

@Vicky_Fegan - you can try TrimStart(new Char { ‘0’ } )

@Vicky_Fegan

This will work -
strNumbers = “001001011”
strNumbers.TrimStart("0"c).ToString
return “1001011”

3 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.