Env: C#, Framework 1.1, VS.NET 2003, ASP.NET, Windows XP Hey All, I am having a problem. I am sure it is something simple but I am trying to Trim the Whitespace and the Special Characters out of a string so that I can use it as a filename. I first call trim
below to remove the whitespace, but the whitespace is still there. Then I call trim with a char array of characters but the apostrophe remains. What am I doing wrong? Here is my code. Thanks for your help! DateTime dt = System.Convert.ToDateTime( lblToDate.Text
); String strFileName = dt.ToString("yyyy_MM"); String strTemp = “Dimple’s Day Care”; String strTrimWS = strTemp.Trim(); String strBadChars = "'`~!@#$%^&*{})([]-+=|/:;.,<>?"; String strProviderName = strTrimWS.Trim(strBadChars.ToCharArray()); strFileName =
strFileName + "_" + strProviderName + "_" + "Inv"; Sincerely, Vince
vmax66
Member
35 Points
7 Posts
Trim Won't WOrk
Aug 05, 2003 07:57 PM|LINK
pickyh3d
Star
9696 Points
1955 Posts
Re: Trim Won't WOrk
Aug 05, 2003 11:49 PM|LINK