issues

  • Thread starter Thread starter troy
  • Start date Start date
T

troy

Hey guys - thanks for being patient with me but I just cant get figure the
solution out. I basically have to read a line of text and figure out
iterations of a word within the line. Its driving me crazy.. Any ideas or
sampel code?

thanks
 
string t = "This is a test and this is another test";

string[] a = t.Split( ' ' );

int count = 0;

for( int i = 0; i < a.Length; i++ )
{
if( a.Equals( "test" ) == true )
{
count++;
}
}

RESULT: count == 2
 
sweet - works like a charm...thank you

Barry Burton said:
string t = "This is a test and this is another test";

string[] a = t.Split( ' ' );

int count = 0;

for( int i = 0; i < a.Length; i++ )
{
if( a.Equals( "test" ) == true )
{
count++;
}
}

RESULT: count == 2

troy said:
Hey guys - thanks for being patient with me but I just cant get figure the
solution out. I basically have to read a line of text and figure out
iterations of a word within the line. Its driving me crazy.. Any ideas or
sampel code?

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top