Here i am using LINQ to get number of uppercase letters within a string,this countUpperLetters method takes the string as parameter and returns number of uppercase letters on it.
/// <summary>
/// Function Name:countUpperLetters
/// Bishnu Tewary
/// 10-09-2013
/// this countUpperLetters method takes the string as parameter
/// and returns number of uppercase letters on it.
/// </summary>
/// <param name="strString">string parameter for which
/// uppercase letters will be counted
/// </param>
/// <returns>int , number of uppercase letteres</returns>
public static int countUpperLetters(string strString)
{
return strString.Count(c => char.IsUpper(c));
}
/// <summary>
/// Function Name:countUpperLetters
/// Bishnu Tewary
/// 10-09-2013
/// this countUpperLetters method takes the string as parameter
/// and returns number of uppercase letters on it.
/// </summary>
/// <param name="strString">string parameter for which
/// uppercase letters will be counted
/// </param>
/// <returns>int , number of uppercase letteres</returns>
public static int countUpperLetters(string strString)
{
return strString.Count(c => char.IsUpper(c));
}
No comments:
Post a Comment