DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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.




Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links