aspose file tools*
The moose likes Java in General and the fly likes Alphanumeric values - range ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Alphanumeric values - range ?" Watch "Alphanumeric values - range ?" New topic
Author

Alphanumeric values - range ?

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1382
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
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14342
    
  22

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 8 API documentation
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1382
HAI5TH comes after "HAI2TK",

"HAI9TD" comes after "HAI5TH"
Raymond Tong
Ranch Hand

Joined: Aug 15, 2010
Posts: 230
    
    2

kri shan wrote:HAI5TH comes after "HAI2TK",

"HAI9TD" comes after "HAI5TH"

You have provided "what" but not "how"
"HAI5TH" comes after "HAI2TK", but why ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Alphanumeric values - range ?