Results 1 to 8 of 8

Thread: Instring equavalant

  1. #1

    Thread Starter
    Hyperactive Member Bloged's Avatar
    Join Date
    May 2001
    Location
    Rotterdam, The Netherlands
    Posts
    330

    Instring equavalant

    He everyone,

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

    Grtz,

    Bloged

  2. #2
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    have a look at the StreamTokenizer class

  3. #3

    Thread Starter
    Hyperactive Member Bloged's Avatar
    Join Date
    May 2001
    Location
    Rotterdam, The Netherlands
    Posts
    330

    Re: streamTokenizer

    Thnx i will have a look!

    Grtz,

    Bloged

  4. #4

    Thread Starter
    Hyperactive Member Bloged's Avatar
    Join Date
    May 2001
    Location
    Rotterdam, The Netherlands
    Posts
    330

    Example

    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

  5. #5
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    not a problem at all

  6. #6

    Thread Starter
    Hyperactive Member Bloged's Avatar
    Join Date
    May 2001
    Location
    Rotterdam, The Netherlands
    Posts
    330
    It is a problem for me so can you please give me an example!

    Grtz,

    Bloged

  7. #7
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    Code:
    while (st.type != StreamTokenizer.TT_EOL && st.ttype != StreamTokenizer.TT_EOF
    {
      //code
    
      st.nextToken();
    }
    where st is an instance of the StreamTokenizer class

  8. #8
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    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)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width