Code to omit leading zeros

Posted by Rajendra.Prasad under ASP.NET MVC on 10/18/2013 | Points: 10 | Views : 873 | Status : [Member] | Replies : 2
Hi All,

Can any one provide me the code in C#.net for omit leading zeros in a given string.

For Eg:

1. 0001 => 1
2. 0010 => 10
3. 0100 => 100
4. 1000 => 1000

i mean to say that, string of the length will be four [4].

Thanks,
Bharatha Rajendra Prasad




Responses

Posted by: Bandi on: 10/18/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Refer this link
http://stackoverflow.com/questions/7010702/how-to-remove-leading-zeros

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Rajendra.Prasad, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nismeh on: 10/18/2013 [Member] Starter | Points: 25

Up
0
Down
Hi,

We have simple function called TrimStart(), in which we can pass char which we want to omit

TrimStart(new Char[]{'0'})

IT KNOWLEDGE IS APPLIED KNOWLEDGE
So Just Do It

Rajendra.Prasad, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response