Remove leading zero's from the employee number

I would like to remove all leading zeros from the employee number.

Example:
00123456 = 123456

Please make sure that its only the leading zeros and not other zeros that exists in the employee number.

Example:
00102030 = 102030

This is what I used:
Employment.EmployeeNumber.TrimStart(new Char[] { ‘0’ } )

1 Like

Hi. What will be the logic for removing N amount of chars from the left? I can’t find documentation in how to use TrimStart or if there’s a TrimLeft method.

1 Like

Use Substring.

The C# Substring method extracts a fragment of a string based on character positions. We specify a start and length (both ints) to describe this fragment.

Example:

00123456

I want the to see 123456 (I don’t want to first 2 characters)

Substring(2)

This article gives great examples: