Counting the Occurence of each letter in a textbox
-
HI I NEED HELP ABOUT COUNTING AN OCCURRENCE OF EACH LETTER IN A TEXTBOX FOR EXAMPLE I HAVE 2 TEXTBOX IN TEXTBOX1 I INPUT THE WORD "HELLO WORLD" THEN WHEN I CLICK BUTTON 1 THEN IT DISPLAY IN TEXTBOX2 LIKE THIS: 1H 1E 3L 2O 1W 1R 1D 1R IT REVERSE AS H1 E1 L3 O2 W1 R1 T1 AS LONG AS IT DISPLAY... THANKS IN ADVANCE I'M NEW IN VB.NET AND I DONT KNOW HOW TO DO THAT...
-
HI I NEED HELP ABOUT COUNTING AN OCCURRENCE OF EACH LETTER IN A TEXTBOX FOR EXAMPLE I HAVE 2 TEXTBOX IN TEXTBOX1 I INPUT THE WORD "HELLO WORLD" THEN WHEN I CLICK BUTTON 1 THEN IT DISPLAY IN TEXTBOX2 LIKE THIS: 1H 1E 3L 2O 1W 1R 1D 1R IT REVERSE AS H1 E1 L3 O2 W1 R1 T1 AS LONG AS IT DISPLAY... THANKS IN ADVANCE I'M NEW IN VB.NET AND I DONT KNOW HOW TO DO THAT...
Maybe this link will help you [^] And Read the Guidelines before you post your thread. The 8th Point.
Every new day is another chance to change your life.
-
HI I NEED HELP ABOUT COUNTING AN OCCURRENCE OF EACH LETTER IN A TEXTBOX FOR EXAMPLE I HAVE 2 TEXTBOX IN TEXTBOX1 I INPUT THE WORD "HELLO WORLD" THEN WHEN I CLICK BUTTON 1 THEN IT DISPLAY IN TEXTBOX2 LIKE THIS: 1H 1E 3L 2O 1W 1R 1D 1R IT REVERSE AS H1 E1 L3 O2 W1 R1 T1 AS LONG AS IT DISPLAY... THANKS IN ADVANCE I'M NEW IN VB.NET AND I DONT KNOW HOW TO DO THAT...
Here is a quick / rough way that I would count the characters in a string
Dim s As Char() = TextBox1.Text.ToCharArray Dim p As New Dictionary(Of Char, integer) For Each chars As Char In s 'ignore the spaces If Not chars = " " Then 'count the occurances of the character Dim i As Integer = s.Count(Function(r) r = chars) 'if the letter is not in the dictonary If Not p.ContainsKey(chars) = True Then p.Add(chars, i) End If End If Next
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
-
HI I NEED HELP ABOUT COUNTING AN OCCURRENCE OF EACH LETTER IN A TEXTBOX FOR EXAMPLE I HAVE 2 TEXTBOX IN TEXTBOX1 I INPUT THE WORD "HELLO WORLD" THEN WHEN I CLICK BUTTON 1 THEN IT DISPLAY IN TEXTBOX2 LIKE THIS: 1H 1E 3L 2O 1W 1R 1D 1R IT REVERSE AS H1 E1 L3 O2 W1 R1 T1 AS LONG AS IT DISPLAY... THANKS IN ADVANCE I'M NEW IN VB.NET AND I DONT KNOW HOW TO DO THAT...
Please do not scream at me. Thank you.
Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
-
Please do not scream at me. Thank you.
Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
-
How do you know that, VB programmers aren't case-sensitive ;P
"You get that on the big jobs."
RobCroll wrote:
VB programmers
I would only tolerate it if my "option strict" was on.
Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
-
Here is a quick / rough way that I would count the characters in a string
Dim s As Char() = TextBox1.Text.ToCharArray Dim p As New Dictionary(Of Char, integer) For Each chars As Char In s 'ignore the spaces If Not chars = " " Then 'count the occurances of the character Dim i As Integer = s.Count(Function(r) r = chars) 'if the letter is not in the dictonary If Not p.ContainsKey(chars) = True Then p.Add(chars, i) End If End If Next
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
Your creating a Dictionary of String to store an Integer?
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
Your creating a Dictionary of String to store an Integer?
A guide to posting questions on CodeProject[^]
Dave KreskowiakOh crap! It was ment too be an integer
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch