Java's equivalent of InStr


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Java's equivalent of InStr

  1. #1
    Kent Guest

    Java's equivalent of InStr


    Hi,

    I need a function in Java that works the same as (or close to the same as)
    the InStr function in VB. The InStr function checks for one string inside
    another one and returns the character number of where the match was found.

    All I need to do is check if one string exists inside another. Any ideas?

    Kent

  2. #2
    Paul Clapham Guest

    Re: Java's equivalent of InStr


    Kent <kentcb@hotmail.com> wrote in message news:3917ab2f$1@news.devx.com...
    >
    > Hi,
    >
    > I need a function in Java that works the same as (or close to the same as)
    > the InStr function in VB. The InStr function checks for one string inside
    > another one and returns the character number of where the match was found.
    >
    > All I need to do is check if one string exists inside another. Any ideas?
    >
    > Kent


    Copied from the Java documentation for the String class:

    indexOf(String str, int fromIndex)
    Returns the index within this string of the first occurrence of the
    specified substring, starting at the specified index.

    The documentation has more detail.




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center