.Net中分割字符串

工作中有时遇到分割字符串的问题、在.Net中用String.Split方法实现,举例如下:
string str="中国|美国|日本";
   string [] mystr=str.Split('|');
   foreach (string i in mystr)
   {
    Response .Write (i.ToString()+"<br>");
   }
输出为:
中国
美国
日本
Response .Write (mystr.Length.ToString());  输出为:3

posted @ 2006-11-04 17:41  chy710  阅读(862)  评论(0编辑  收藏  举报