假設初始的字符串是如何用_(下劃線)替換字符串中的空格?
String result= "Welcome To All" for that i need updated result as
String result="Welcome_To_All" string value is dynamic,how can i do that,thank for help?
假設初始的字符串是如何用_(下劃線)替換字符串中的空格?
String result= "Welcome To All" for that i need updated result as
String result="Welcome_To_All" string value is dynamic,how can i do that,thank for help?
我相信這是你在找什麼
string oldstr = "Hello World";
string s = oldstr.Replace(" ", "_");
(s == "Hello_World");
謝謝,工作正常 – tajMahal
我要猜你正在使用JavaScript和你確定使用正表達式。
result = result.replace(/ /g, "_");
什麼語言正在使用? – Anonymouse