string str = "Hello.World!";
string[] split = str.Split(new Char[] { '.', '!' });
foreach (string s in split)
{
if (s.Trim()!= "")
Console.WriteLine(s); }
Response.Write(str.ToString() + "<br>");运行结果为:Hello.World!虽然没有错误.正确答案应该为 Hello
World
string[] split = str.Split(new Char[] { '.', '!' });
foreach (string s in split)
{
if (s.Trim()!= "")
Console.WriteLine(s); }
Response.Write(str.ToString() + "<br>");运行结果为:Hello.World!虽然没有错误.正确答案应该为 Hello
World
string str = "Hello.World!";
string[] split = str.Split(new Char[] { '.', '!' });
foreach (string s in split)
{
if (s.Trim()!= "")
Response.Write(s+ " <br>"); }
//Response.Write(str.ToString() + " <br>");
string[] split = str.Split('.');
string[] split1 = split[1].Split('!');
Console.WriteLine(split[0]); Hello
Console.WriteLine(split1[0]);World