1. Many people have encountered the problem of unsuccessful replacement of string Replace.
String aa = "Dear $ name, thank you for choosing this website. Your order $ no on this website has been submitted successfully. Please complete the payment within 2 hours, so that we can deliver the goods to you as soon as possible. If you have any questions, please call: 4007-336-337 ";
Aa. Replace ("$ name", "ceshi000 ");
Aa. Replace ("$ no", "2012090400032 ");
Response. Write (aa );
The above Code shows that there is no problem, but the replacement fails. Why?
The reason is that you need to assign a value to the string aa again during replacement, as shown below:
String aa = "Dear $ name, thank you for choosing this website. Your order $ no on this website has been submitted successfully. Please complete the payment within 2 hours, so that we can deliver the goods to you as soon as possible. If you have any questions, please call: 4007-336-337 ";
Aa = aa. Replace ("$ name", "ceshi000 ");
Aa = aa. Replace ("$ no", "2012090400032 ");
Response. Write (aa); www.2cto.com
In this way, the replacement is successful.
2. during development, some of the content contains HTML tags, which are sometimes not needed. How can this problem be removed? As follows:
String Smes = System. Text. RegularExpressions. Regex. Replace (message, "<. *?> "," "). Replace (" & nbsp ;","");
Note: message contains HTML tags.