• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Alphanumeric values - range ?

 
kri shan
Ranch Hand
Posts: 1478
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15495
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
kri shan
Ranch Hand
Posts: 1478
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HAI5TH comes after "HAI2TK",

"HAI9TD" comes after "HAI5TH"
 
Raymond Tong
Ranch Hand
Posts: 255
2
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kri shan wrote:HAI5TH comes after "HAI2TK",

"HAI9TD" comes after "HAI5TH"

You have provided "what" but not "how"
"HAI5TH" comes after "HAI2TK", but why ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic