When using the Response.Write() function to output a string to an html page, sometimes the output is not as expected because of the default entity of html. for example:
Response.Write("hi tom"); //There are six spaces in the middle of the string, but the display on the web page is: hi tom //HTML automatically merges consecutive spaces into one.
To achieve the expected effect, it must be as follows :
Response.Write("hi tom");
This seems very cumbersome. You can write a function to automatically replace " " with ;  for you. The code is as follows:
-------------------------------------------------- ----------------
public string FormatString(string str)
{
str=str.Replace(" "," ");
str=str.Replace("<","<");
str=str.Replace(">",">");
str=str.Replace('n'.ToString(),"<br>");
return str;
}
-------------------------------------------------- ----------------
In this way, if you want to output "hi tom", you can write:
----------------------------------------
string str1 = "hi tom" ;
Respone.Write(FormatString(str));
----------------------------------------
For example, the following statement:
--------------------------------------------------------
string str1 = "Hi , TomnHi , Jimn<===>";
Response.Write(FormatString(str1));
--------------------------------------------------------
The output on the web page is:
Hi Tom
Hi Jim
<====>
Of course, you can extend this function with more functions.