Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Sienna Hughes   on Sep 18 In Java Category.

  
Question Answered By: Darrell Harvey   on Sep 18

Are you trying to sort  "inches" and "feet"?

If so, you need to cast both objects in your comparrison to a
String. Then, use a <string>.indexOf("\"") to find where the " is or
a <string>.indexOf("\'"); to find where the ' is.

Then, you can use a substring method to extract the numeric and
the "measurement type" from the string.

Now, you can convert each number to an int and multiply the ints
which represent "feet" by 12 to normalize all the metrics. Now, you
can actually compare the two values.

This seems like a lot of work, but it really isn't. And once you
write it, you don't have to do it again.

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on JDBC and MS Access Or get search suggestion and latest updates.


Tagged: