| Author |
Alphanumeric values - range ?
|
kri shan
Ranch Hand
Joined: Apr 08, 2004
Posts: 1300
|
|
finding range between two alphanumeric values - like between HAI2TK and HAI9TD ? ( "HAI2TK", "HAI5TH","HAI9TD" )
implementing Comparator interface with compareTo() might supports. Any other optimized way ?
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12907
|
|
To implement this, you'll have to know what the logic behind the series is. For example, what is the next code after "HAI2TK"? When does one code come after or before another code in the series?
You didn't say anything about that logic, so we can't tell you exactly how to implement it in Java code.
Implementing a Comparator is indeed a way to express this in Java code.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
kri shan
Ranch Hand
Joined: Apr 08, 2004
Posts: 1300
|
|
HAI5TH comes after "HAI2TK",
"HAI9TD" comes after "HAI5TH"
|
 |
Raymond Tong
Ranch Hand
Joined: Aug 15, 2010
Posts: 156
|
|
kri shan wrote:HAI5TH comes after "HAI2TK",
"HAI9TD" comes after "HAI5TH"
You have provided "what" but not "how"
"HAI5TH" comes after "HAI2TK", but why ?
|
 |
 |
|
|
subject: Alphanumeric values - range ?
|
|
|