c# - Replace backslash(\) with empty string -


hi having problem while replacing string have backslash()

string sregex = "2004\01".replace("\\", ""); response.write(sregex); // giving me 20041 

but same when include 2 backslashes giving me output expected

string sregex = "2004\\01".replace("\\", ""); response.write(sregex); // giving me 200401  string sreplace = "2004\01"; string sregex = sreplace.replace("\\", ""); 

so there possibility on come first case? should display same result

\0 null character need use verbatim string compiler treat first back-slash instead of escape sequence

string sregex = @"2004\01".replace("\\", ""); 

Comments

Popular posts from this blog

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -