Hello Everyone, would like to ask if how to count the lowercase letter detected in textbox? please refer me to the right link or please give me example?
Thank you & Godbless
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jaganathan BantheswaranPosted Nov 14, 2013, 12:03 AM
You can count using RegEx.
using System.IO;
using System;
using System.Text.RegularExpressions;
class Program
{
static void Main()
{
string strRegex = @"(?<=[a-z])";
RegexOptions myRegexOptions = RegexOptions.Multiline;
Regex myRegex = new Regex(strRegex, myRegexOptions);
string strTargetString = @"ADGFesD";
Console.WriteLine("The string has " + myRegex.Matches(strTargetString).Count + " lowercase letters");
}
}
mary jean ligasPosted Nov 14, 2013, 12:03 AM
Rajesh Kumar JhaPosted Nov 14, 2013, 12:00 AM
Try Doing the following....
foreach (char ch in TextBox1.Text.ToCharArray())
{
if(Char.IsLower(ch))
count++;
}