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
Need to know how to set a cell to blank when the value is an integer like relace 0 and 0.00 with a blank
How to avoid page refresh on a button click
IE 7.0 failed to surf any website
OCS Federation with Microsoft
On logon an explorer window opens to 'Netlogon' from the DC
Sharepoint Server Error in '/' Application
Apostrophe included in SQL Insert string
Dell Latitude Z600 and Dual Monitors
xbox rockband & lips microphones
Handling Asynchronous Timeouts