Article View: borland.public.jbuilder.java.swing
Article #11247Re: JTextfield substring
From: Steve Horsley
Date: Tue, 22 Jun 1999 00:00
Date: Tue, 22 Jun 1999 00:00
19 lines
1152 bytes
1152 bytes
Try something like this (I assume you want the last 10 chars):
int end = textfield.getText().length();
int start = end - 10;
if(start < 0)
start = 0;
String sub = textfield.getText().substring(start, end);
Steve
//-----------------------
Yasser wrote:
>
> Wanted to know if there is a function that can return to me part of a
> string entered in a JTextfield. substring(start pos,end pos) reads a
> string from the starting position to the ending position ... in my case
> wanted to read the string from its ending position to a specified number
> of characters..
>
> yasser
Technical Details
Message-ID:
<376F4EAE.1A03F259@cwcom.co.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<376EC3B4.CEFFDD0@cs.twsu.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,5c1fc6a6fbec69de X-Google-Attributes: gid111d45,public From: Steve Horsley <steve.horsley@cwcom.co.uk> Subject: Re: JTextfield substring Date: 1999/06/22 Message-ID: <376F4EAE.1A03F259@cwcom.co.uk> X-Deja-AN: 492436189 Content-Transfer-Encoding: 7bit References: <376EC3B4.CEFFDD0@cs.twsu.edu> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Cable & Wireless Communications Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing