C# Word occurrences count with string.compare() [on hold]











up vote
-1
down vote

favorite












I have to write a Windows Application program in Visual Studio(2017). So the thing is there is a readonly textboxt with a longer text. And the program must count how many times occurences a word (user input in textbox2) in textbox1. Its like the ctrl+f command, but only the number of the word occurences. I must use the String.Compare() command. Any ideas?
I did a research and yeah, i know it returns -1, 0 or 1. And I unfortunately still don't know how to count that.



        int index = 0;
string tb1text = textBox1.Text.ToUpper();
string tb2text = textBox2.Text.ToUpper();
index = (String.Compare(tb1text, tb2text));

MessageBox.Show(index.ToString());









share|improve this question









New contributor




flexyd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as unclear what you're asking by Tyler Roper, dbc, greg-449, Roman Pokrovskij, Marvin Nov 17 at 23:36


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.











  • 1




    "Any ideas?" Have you tried using String.Compare()...? You should look up what that method does and work on trying it yourself. We're here to help but we're not here to do your homework.
    – Tyler Roper
    Nov 17 at 14:14












  • Are you looking for String compare C# - whole word match or How to count of sub-string occurrences?? I must use the String.Compare() command. -- why?
    – dbc
    Nov 17 at 17:42















up vote
-1
down vote

favorite












I have to write a Windows Application program in Visual Studio(2017). So the thing is there is a readonly textboxt with a longer text. And the program must count how many times occurences a word (user input in textbox2) in textbox1. Its like the ctrl+f command, but only the number of the word occurences. I must use the String.Compare() command. Any ideas?
I did a research and yeah, i know it returns -1, 0 or 1. And I unfortunately still don't know how to count that.



        int index = 0;
string tb1text = textBox1.Text.ToUpper();
string tb2text = textBox2.Text.ToUpper();
index = (String.Compare(tb1text, tb2text));

MessageBox.Show(index.ToString());









share|improve this question









New contributor




flexyd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as unclear what you're asking by Tyler Roper, dbc, greg-449, Roman Pokrovskij, Marvin Nov 17 at 23:36


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.











  • 1




    "Any ideas?" Have you tried using String.Compare()...? You should look up what that method does and work on trying it yourself. We're here to help but we're not here to do your homework.
    – Tyler Roper
    Nov 17 at 14:14












  • Are you looking for String compare C# - whole word match or How to count of sub-string occurrences?? I must use the String.Compare() command. -- why?
    – dbc
    Nov 17 at 17:42













up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











I have to write a Windows Application program in Visual Studio(2017). So the thing is there is a readonly textboxt with a longer text. And the program must count how many times occurences a word (user input in textbox2) in textbox1. Its like the ctrl+f command, but only the number of the word occurences. I must use the String.Compare() command. Any ideas?
I did a research and yeah, i know it returns -1, 0 or 1. And I unfortunately still don't know how to count that.



        int index = 0;
string tb1text = textBox1.Text.ToUpper();
string tb2text = textBox2.Text.ToUpper();
index = (String.Compare(tb1text, tb2text));

MessageBox.Show(index.ToString());









share|improve this question









New contributor




flexyd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I have to write a Windows Application program in Visual Studio(2017). So the thing is there is a readonly textboxt with a longer text. And the program must count how many times occurences a word (user input in textbox2) in textbox1. Its like the ctrl+f command, but only the number of the word occurences. I must use the String.Compare() command. Any ideas?
I did a research and yeah, i know it returns -1, 0 or 1. And I unfortunately still don't know how to count that.



        int index = 0;
string tb1text = textBox1.Text.ToUpper();
string tb2text = textBox2.Text.ToUpper();
index = (String.Compare(tb1text, tb2text));

MessageBox.Show(index.ToString());






c# string windows visual-studio compare






share|improve this question









New contributor




flexyd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




flexyd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Nov 17 at 14:33





















New contributor




flexyd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 17 at 14:11









flexyd

12




12




New contributor




flexyd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





flexyd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






flexyd is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




put on hold as unclear what you're asking by Tyler Roper, dbc, greg-449, Roman Pokrovskij, Marvin Nov 17 at 23:36


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






put on hold as unclear what you're asking by Tyler Roper, dbc, greg-449, Roman Pokrovskij, Marvin Nov 17 at 23:36


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 1




    "Any ideas?" Have you tried using String.Compare()...? You should look up what that method does and work on trying it yourself. We're here to help but we're not here to do your homework.
    – Tyler Roper
    Nov 17 at 14:14












  • Are you looking for String compare C# - whole word match or How to count of sub-string occurrences?? I must use the String.Compare() command. -- why?
    – dbc
    Nov 17 at 17:42














  • 1




    "Any ideas?" Have you tried using String.Compare()...? You should look up what that method does and work on trying it yourself. We're here to help but we're not here to do your homework.
    – Tyler Roper
    Nov 17 at 14:14












  • Are you looking for String compare C# - whole word match or How to count of sub-string occurrences?? I must use the String.Compare() command. -- why?
    – dbc
    Nov 17 at 17:42








1




1




"Any ideas?" Have you tried using String.Compare()...? You should look up what that method does and work on trying it yourself. We're here to help but we're not here to do your homework.
– Tyler Roper
Nov 17 at 14:14






"Any ideas?" Have you tried using String.Compare()...? You should look up what that method does and work on trying it yourself. We're here to help but we're not here to do your homework.
– Tyler Roper
Nov 17 at 14:14














Are you looking for String compare C# - whole word match or How to count of sub-string occurrences?? I must use the String.Compare() command. -- why?
– dbc
Nov 17 at 17:42




Are you looking for String compare C# - whole word match or How to count of sub-string occurrences?? I must use the String.Compare() command. -- why?
– dbc
Nov 17 at 17:42

















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Costa Masnaga

Fotorealismo

Sidney Franklin