using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
public class MainClass{
public static void Main(string[] args){
String MyString = "a;@b,c:d?e+ hello!";
int CharCount = MyString.SpecialCharCount();
Console.WriteLine(CharCount.ToString());
}
}
public static class MyStrings
{
public static int SpecialCharCount(this String Str)
{
var CharQuery = from ThisCount in Str where ThisCount == '!'
|| ThisCount == '@'
|| ThisCount == ';'
|| ThisCount == ','
|| ThisCount == ' '
select ThisCount;
return CharQuery.Count<Char>();
}
}
|