c# - How can I Trim the leading comma in my string -


i have string below.

,liger, unicorn, snipe 

in other languages i'm familiar can string.trim(",") how can in c#?

thanks.


there's been lot of , forth starttrim function. several have pointed out, starttrim doesn't affect primary variable. however, given construction of data vs question, i'm torn answer accept. true question wants first character trimmed off not last (if anny), however, there never "," @ end of data. so, said, i'm going accept first answer that said use starttrim assigned new variable.

string sample = ",liger, unicorn, snipe"; sample = sample.trimstart(','); // remove first comma 

or perhaps:

sample = sample.trim().trimstart(','); // remove whitespace , first comma 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -