المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Regex.Split help



C# Programming
03-04-2010, 01:53 AM
I am counting words in string, that i get from text file. Using this code i get always 1 more word in counting. What could be wrong?
int stevec = 0;
string s="avc sde s a s" string[] words = Regex.Split(s, @"[\S]+");
foreach (string word in words)
{
stevec++;
}


After deb stevec has value 6. But there are only 5 words.