字符串操作
2012-04-24 22:34 精诚所至 金石为开 阅读(179) 评论(0) 收藏 举报本示例将一串字符串以空格键分割成数组元素。
using System;
namespace a
{
class Program
{
public static void Main(string[] args)
{
string myString ="This is a test.";
char[] separator={' '};
string[] myWords;
myWords=myString.Split(separator);
foreach (string word in myWords)
{
Console.WriteLine("{0}",word);
}
Console.ReadKey();
}
}
}
浙公网安备 33010602011771号