how to count vowel given string (in textbox) using asp.net ?

Posted by Jsathish06 under ASP.NET on 6/3/2011 | Points: 10 | Views : 3954 | Status : [Member] | Replies : 5
how to count vowel given string (in textbox) using asp.net ?




Responses

Posted by: Bugwee on: 6/3/2011 [Member] Starter | Points: 25

Up
0
Down
hi,

add this one

Dim pattern As String = "[aeiou]"
TxtCountResult.Text = System.Text.RegularExpressions.Regex.Matches(TxtInputString.Text, pattern).Count


Regards,
Bugwee

Jsathish06, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 6/3/2011 [Member] Bronze | Points: 25

Up
0
Down
hi bugwee.....
I am writing this code but its working working....


 string str = TextBox1.Text;

Label1.Text = Convert.ToString(Regex.Matches("str", "aeiouAEIOU").Count);
Response.Write(Label1.Text);


I am using button_click event...
Please help regarding this...

Thanks and Regards
Akiii


Jsathish06, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bugwee on: 6/4/2011 [Member] Starter | Points: 25

Up
0
Down
hi,

In your button_click event
string pattern = "[aeiou]";

string str = TextBox1.Text;
Regex reg = new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);
Label1.Text = Convert.ToString(reg.Matches(str).Count);


Regards,
Bugwee

Jsathish06, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 6/4/2011 [Member] Bronze | Points: 25

Up
0
Down
hi bugwee....

excellent man.....your code is working like a breeze....
you have always been helpful....

Thumbs up..
Regards
Akiii

Jsathish06, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bugwee on: 6/4/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Akiii,

Alright, Thanks..

Cheers,
Bugwee


Jsathish06, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response