Article View: borland.public.jbuilder.java.api
Article #1100Re: < or >
From: Alexander Petry
Date: Thu, 20 Jun 2002 19:55
Date: Thu, 20 Jun 2002 19:55
42 lines
2666 bytes
2666 bytes
On Thu, 20 Jun 2002, coff@online.no spake thusly: > You can not compare two strings using less-than or greater-than. > What are you trying to accomplish? compare the size or? I think, that he means how to compare strings lexicographically. > > On Thu, 20 Jun 2002 21:30:23 +0200, "Reiz" <RReiz@gmx.de> wrote: > >>How can I do it in Java >> >>If (String1 < String2) then >> ... >> code .... >> .... >>end if >> Have a look at the java api of the String class. It says this: ,----[ compareTo(String s) method ] | compareTo | | public int compareTo(String anotherString) | | Compares two strings lexicographically. The comparison is based on | the Unicode value of each character in the strings. The character | sequence represented by this String object is compared | lexicographically to the character sequence represented by the | argument string. The result is a negative integer if this String | object lexicographically precedes the argument string. The result is a | positive integer if this String object lexicographically follows the | argument string. The result is zero if the strings are equal; | compareTo returns 0 exactly when the equals(Object) method would | return true. | ... | `---- Alex
Technical Details
Message-ID:
<87660d912w.fsf@nbook.wohnheim.uni-kl.de>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-han1.dfn.de!news-stu1.dfn.de!news.belwue.de!news.uni-kl.de!not-for-mailReferences:
<aetafp$9tjac$1@ID-97157.news.dfncis.de> <3d122f57.20062197@news.online.no>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,59a0cb87210dc727
X-Google-Attributes: gid1089d0,public
X-Google-Thread: 113ae9,59a0cb87210dc727
X-Google-Attributes: gid113ae9,public
X-Google-ArrivalTime: 2002-06-20 12:54:21 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-han1.dfn.de!news-stu1.dfn.de!news.belwue.de!news.uni-kl.de!not-for-mail
From: Alexander Petry <alex_petry-nospam@web.de>
Newsgroups: borland.public.jbuilder.java.api,comp.lang.java.help
Subject: Re: < or >
Date: 20 Jun 2002 21:55:51 +0200
Organization: University of Kaiserslautern
Lines: 42
Sender: alex@nbook.wohnheim.uni-kl.de
Message-ID: <87660d912w.fsf@nbook.wohnheim.uni-kl.de>
References: <aetafp$9tjac$1@ID-97157.news.dfncis.de> <3d122f57.20062197@news.online.no>
NNTP-Posting-Host: rotes278.wohnheim.uni-kl.de
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: news.uni-kl.de 1024602800 14890 131.246.178.88 (20 Jun 2002 19:53:20 GMT)
X-Complaints-To: usenet@news.uni-kl.de
NNTP-Posting-Date: Thu, 20 Jun 2002 19:53:20 +0000 (UTC)
X-Face: V|+c;4!|B?E%BE^{E6);aI.[<<r#uCVjK"~Ke!@0vxS/.,wki/c|uVnNV!BA-_gY2sfoGc3
f{#/$PT>97Zd*>^#%Y5Cxv;%Y[PT-LW3;A:fRrJ8+^k"e7@+30g0YD0*^^3jgyShN7o?a]Cla*Zv'5
NA,=963bM%J^o]C
X-OS: Debian GNU/Linux
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2