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("+", "-");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.