Remove special character from string

using C# I have a string which is a filename of a file being uploaded. on some systems a period can be used as part of a filename like ".testfile.pdf"  I need to remove the period only if it is the first character in the string.  I have tried replace but all periods are removed and i haven't been able to tuse regex either.
Who is Participating?
you can use TrimStart from string to do that:

for example:
  string cleanFileName = ".testfile.txt".TrimStart('.');
rmardisAuthor Commented:
This was it, Thank you for your speedy answer.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.