开发者

Rewrite rule to replace all + with -

开发者 https://www.devze.com 2023-03-10 22:02 出处:网络
My url contains all\' + \'s like path/My+Property+Details but I need to replace 开发者_运维知识库all + with \'-\'.and make it:

My url contains all' + 's like path/My+Property+Details but I need to replace 开发者_运维知识库all + with '-'.and make it:

path/My-Property-Details.


Use String.Replace(..), like so:

string s = "path/My+Property+Details";
s = s.Replace("+", "-");

Don't forget the assignment because a string is immutable.


Use String.Replace.

url = url.Replace("+", "-");


Try this:

string newURL = oldUrl.Replace("+", "-");
0

精彩评论

暂无评论...
验证码 换一张
取 消