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
Programmatically create IIS host header using VBScript / ASP?
SQL Server 2005 Error, Ex_handle_except encountered exception C0000005 - Server terminating
Outlook xp exchange 2010
How do I send email messages via Access using addresses from a table? The message will be different for each receiver.
What would cause the Report_NoData Sub routine to run twice? Access 2003
eePC SSD space issue
Deploying SP3 for XP via WSUS 2.0
Using application.international (what library needs referenced)
WIN32_FIND_DATA Size problem
reading a text file and saving to access