Tuesday, July 29, 2014

How can i remove/delete digits in the beginning of a string ?

You can even try extension functions:



string sample = "2. hi";

string result =
string.Concat(
sample
.SkipWhile( char.IsWhiteSpace )
.SkipWhile( char.IsDigit )
.SkipWhile( ( c, i ) => i == 0 && c == '.' )
.SkipWhile( char.IsWhiteSpace ) );



No comments:

Post a Comment