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

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

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

unit testing - How to mock PreferenceManager in Android? -