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

ruby - How do I merge two hashes into a hash of arrays? -

java - the value of local variable is not used -