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
SQL Server Query based on String Format
Bypass memory test on bootup
Assign XML to variable from FOR XML Path
Character unreadable in a remote SSMS
MS Access 2007 create csv file - quit excel object without asking to save.
how to find MailboxGUID from an Exchange database
IF EXISTS, OUTPUT INTO
Problem with a recently installed program not appearing in my All Programs List.
Displaying the color index of a cell
Set Subquery Parameter from query