stc*_*flw 0 html c# replace special-characters
return mystring.replace(/&/g, "&").replace(/>/g, ">")
.replace(/</g, "<").replace(/"/g, """);
Run Code Online (Sandbox Code Playgroud)
以上是我的代码,我想因为它跟踪字符串4次,所以它会变慢.有没有其他方法(方法首选)只在一个循环中替换这些特殊字符?好吧,我可以使用for循环并通过char检查char,但它不是我想要的东西.
谢谢.