aspose file tools*
The moose likes Beginning Java and the fly likes Find the lowest string using Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Find the lowest string using Java" Watch "Find the lowest string using Java" New topic
Author

Find the lowest string using Java

Eshwar Prasad
Ranch Hand

Joined: Mar 21, 2008
Posts: 202

I have two strings "XYO2" and "M7I9". I have a requirement to pick lowest of these string. Actually, the result of this selection should be similar to NLSSORT (AMERICAN Lang) functionality of ORACLE.

Should I calculate and sum up the ASCII value of every character in those Strings and then come to the conclusion which is the lowest or is there any other way in java. please suggest.

Thanks in Advance
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14272
    
  21

Have a look at the API documentation of class java.lang.String and check if there are methods there that you could use to compare the strings.

You don't have to do anything complicated like calculate and sum up the ASCII value of the characters. (Summing up the characters? That wouldn't even work to sort the strings).


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
Don't get me started about those stupid light bulbs.
 
subject: Find the lowest string using Java