PDA

Click to See Complete Forum and Search --> : Instring equavalant


Bloged
Feb 25th, 2002, 09:26 AM
He everyone,

Does Java has a instring equavalant? I must know the number of a specified character in a string?

Grtz,

Bloged

axion_sa
Feb 25th, 2002, 09:32 AM
have a look at the StreamTokenizer class

Bloged
Feb 25th, 2002, 09:35 AM
Thnx i will have a look!

Grtz,

Bloged

Bloged
Feb 25th, 2002, 09:41 AM
How do I loop through a file? please can you give an example?

I now use:
while strString.tt_eol
{
}

strString is a string

Thanx in advance

Grtz,

Bloged

axion_sa
Feb 25th, 2002, 09:42 AM
not a problem at all :)

Bloged
Feb 25th, 2002, 09:44 AM
It is a problem for me so can you please give me an example!

Grtz,

Bloged

axion_sa
Feb 25th, 2002, 09:46 AM
while (st.type != StreamTokenizer.TT_EOL && st.ttype != StreamTokenizer.TT_EOF
{
//code

st.nextToken();
}


where st is an instance of the StreamTokenizer class

Dillinger4
Feb 25th, 2002, 02:55 PM
Bloged
Does Java has a instring equavalant? I must know the number of a specified character in a string?


To get the index value of a specific character in a string
use the public int indexOf(char c) or public int indexOf(char c, int fromIndex)