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());
c# string windows visual-studio compare
New contributor
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.
add a comment |
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());
c# string windows visual-studio compare
New contributor
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 usingString.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
add a comment |
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());
c# string windows visual-studio compare
New contributor
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
c# string windows visual-studio compare
New contributor
New contributor
edited Nov 17 at 14:33
New contributor
asked Nov 17 at 14:11
flexyd
12
12
New contributor
New contributor
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 usingString.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
add a comment |
1
"Any ideas?" Have you tried usingString.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
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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