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
How do i create an Excel macro to copy/paste cell contents from one cell to another?
UCC SSL certificate?
Using a Button To Insert Object Into Access 2007 Form
Windows 7 Terminal Services Manager
Sporadic Transaction Log Backup failure
Network Admin Password Change
outlook 2007 displays white text
Can't view *.mht/*.mhtml files
Access ADP / SQL 2008 locking records
DPM Hot Fix KB970868 does NOT resolve Issue 7