I am having a few problems with trying to replace backslashes in a date string on C# .net.
So far I am using:
string.Replace(@"\","-")
but it hasnt done the replacement. Could anyone please help?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
string.Replacedoes not modify the string itself but returns a new string, which most likely you are throwing away. Do this instead:On a side note, this kind of operation is usually seen in code that manually mucks around with formatted date strings. Most of the time there is a better way to do what you want (which is?) than things like this.