states = " CA,OR,TX, HI ";
List l = Arrays.asList(states);
if (list.contains("CA") {
// true
} else {
// false
}
Greg Nudelman
<greg.nudelman To: "jdjlist" <[EMAIL PROTECTED]>
@imx.com> cc:
Subject: [jdjlist] String List Compare
2003/03/26
01:31 PM
Please respond
to "jdjlist"
I have a DB field of user-entered 2-letter states, separated by a comma.
states = "CA, OR, TX";
or it could be
states = " CA,OR,TX, HI ";
in other words, spacing is inconsistent, but case seems to be OK.
I need to relaibly and FAST! answer:
is state = "CA" in states
Any ideas?
Greg
----------------------------------------------
P.S. this is what we got so far:
1) run a perl script on DB that will remove the extra spacing
2) add the flanking commas to both:
state = ",CA,";
states = ",CA,OR,TX,HI,";
3) states.indexOf(state) != -1
Greg
---
You are currently subscribed to jdjlist as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]
http://www.sys-con.com/fusetalk
******************************************************************************
This email message is confidential to the intended recipient and may be
legally privileged. It is intended solely for the addressee. Access to this
email by anyone else is unauthorized. Any unauthorised use, dissemination
of the information, or copying of this message is prohibited. If you are
not the intended addressee, kindly notify the sender by return e-mail
and delete this message.
******************************************************************************
---
You are currently subscribed to jdjlist as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
http://www.sys-con.com/fusetalk