Article View: borland.public.jbuilder.java.language
Article #16450Re: compareTo
From: Dillan Fernando
Date: Mon, 22 Feb 1999 00:00
Date: Mon, 22 Feb 1999 00:00
27 lines
1117 bytes
1117 bytes
Hi!
String.compareTo() works the same way as "C" strcmp() function.
eg.
String s1 = "ABC"
String s2 = "ABD"
String s3 = "ABD"
System.out.println(''"+s1.compareTo(s2)); ---> output =1
System.out.println(""+s2.compareTo(s1));--->output= -1
System.out.println(""+s2.compareTo(s3)); ---> output = 0
Hope this helps
Regards
Dillan Fernando
Paul wrote in message <36D1A776.2F1A9D48@ott.igs.net>...
>I can't for the life of me figure out how to use the String function
>compareTo. I find the documentation very ambuguious. If anyone could
>help that would be great
>E-mail: pajabrda@igs.net
>thanks-pk
>
Technical Details
Message-ID:
<7as4hj$r4r19@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<36D1A776.2F1A9D48@ott.igs.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,d613ef201fb66407 X-Google-Attributes: gidf74b3,public From: "Dillan Fernando" <dillan@geocities.com> Subject: Re: compareTo Date: 1999/02/22 Message-ID: <7as4hj$r4r19@forums.borland.com> X-Deja-AN: 447147403 References: <36D1A776.2F1A9D48@ott.igs.net> X-Mimeole: Produced By Microsoft MimeOLE V4.72.3110.3 Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.language