-
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
-
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
Forum Rules
|
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
|
Bookmarks