🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

comparing values of strings

#8001
From: Tami Poupko
Date: Tue, 08 May 2001 19:25
20 lines
1239 bytes
I need to do a compare that will treat 010 the same as 10 (without the
preceeding 0). Do I have to convert to an integer value before comparing
or is there an exsisting method for it (like the equals or the
compareTo)?

Thanks,

Tami

For Example:

String s = "10";
String ss = "010";

When doing:
if(s.compareTo(ss) == 0) {
do something
}
It does not equals 0 now since string s has 2 characters and string ss
has 3. So this compare will not be equals 0.
Technical Details
Message-ID: <3AF84811.4A097F7C@udscorp.com>
Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,37e438061025165f,start
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-05-08 10:34:29 PST
Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail
From: Tami Poupko <Poupko@udscorp.com>
Newsgroups: borland.public.jbuilder.java.language
Subject: comparing values of strings
Date: Tue, 08 May 2001 12:25:05 -0700
Organization: Ultramar Diamond Shamrock
Message-ID: <3AF84811.4A097F7C@udscorp.com>
Reply-To: Poupko@udscorp.com
X-Mailer: Mozilla 4.5 [en] (WinNT; I)
X-Accept-Language: en
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Complaints-To: newsabuse@supernews.com
Lines: 21