Microsoft
Software
Hardware
Network
Question : 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.
Answer : Remove special character from string
you can use TrimStart from string to do that:
http://msdn.microsoft.com/
fr-fr/libr
ary/
system
.string.tr
imstart.as
px
for example:
string cleanFileName = ".testfile.txt".TrimStart(
'.');
Random Solutions
Disappearing Appointments in Exchange 2007, Outlook 2007 mailboxes
Windows 7 Remote Desktop Connection Error
Need to query if a field starts with "+1"
Userform Search
Downloads freeze Win98SE Laptop, but surfin' works fine
Why am I getting this clipboard warning message on IE8?
Convert date from mm/dd/yyyy to yyyymmdd
Comparable Objects
Remove special character from string
Validate front end server configuration error