🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: substring?

#19069
From: Richard Evans
Date: Thu, 12 Mar 1998 00:00
23 lines
1194 bytes
Mike,

     String temp = textField1.getText();
      myString1.setText(temp.substring(0, temp.indexOf("-")));
      myString2.setText(temp.substring(temp.indexOf("-") + 1,
temp.indexOf(",")));
      myString3.setText(temp.substring(temp.indexOf(",") + 1,
temp.length()));

Rich Evans.


Mike Harris wrote:

> I have a string in textField1 = "ABC-123,DEF". I would like the result
> to be 3 strings: mystring1 = "ABC", mystring2 = "123", and mystring =
> "DEF".  I am having problems with using substring and indexOf (to find
> the positions of "-" and ",").  What would be the proper syntax?  Am I
> using the correct functions?
>
> THANKS!
> Mike
Technical Details
Message-ID: <3507950B.E0E9DB41@genrad.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <35076C2C.77C6@harrismedia.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,6960f1f07e315512
X-Google-Attributes: gidf74b3,public
From: Richard Evans <evansar@genrad.co.uk>
Subject: Re: substring?
Date: 1998/03/12
Message-ID: <3507950B.E0E9DB41@genrad.co.uk>
X-Deja-AN: 333254778
Content-Transfer-Encoding: 7bit
References: <35076C2C.77C6@harrismedia.com>
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language