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
Simple Update Query
Office 2007 Install Terminal Server
Sharepoint Portal Services Restore failure
Windows 2008 r2 Cluster Shared Volume - Stuck "Online (Backup in progress, Redirected access)"
Editting Access Table/Query from Excel with Microsoft Query
System resource exceeded.
ODBC DSN Connection refresh for multiple tables
Word unable to print picture
Need to kill an application that is auto starting on Windows CE 5.0
How to compact the SYSTEM hive of the registry?