🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #15188

Re: Anything like strstr in java?

#15188
From: Tom Davies
Date: Sun, 04 Jul 1999 00:00
14 lines
993 bytes
Eric Advincula wrote:
> 
> I need to check a portion of a string for a string sequence.
> Ex. string1 = "This is a test for today"
>       string2 = "test"
> 
> I want to be able check if the string1 if string2 occurs in any part of it.
> Is there any java version of strstr() in java?

int n = string1.indexOf(string2);

returns the index within string1 of the first occurence of string2.

Tom
Technical Details
Message-ID: <377E6E48.9B4A8F9E@smartchat.net.au>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7lkbdr$4r51@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,1145741c16a8a24
X-Google-Attributes: gidf74b3,public
From: Tom Davies <tom@smartchat.net.au>
Subject: Re: Anything like strstr in java?
Date: 1999/07/04
Message-ID: <377E6E48.9B4A8F9E@smartchat.net.au>
X-Deja-AN: 496713389
Content-Transfer-Encoding: 7bit
References: <7lkbdr$4r51@forums.borland.com>
To: Eric Advincula <eric07@earthlink.net>
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language