A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Find the lowest string using Java
Joined: Mar 21, 2008
Dec 13, 2010 12:16:22
I have two strings "XYO2" and "M7I9". I have a requirement to pick lowest of these
. 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
. please suggest.
Thanks in Advance
Jesper de Jong
Joined: Aug 16, 2005
Dec 13, 2010 12:18:50
Have a look at the API documentation of class
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
rocket mass heater
subject: Find the lowest string using Java
saprating strings with commas one by one
method construction trouble
how many bytes in char
what is the trick
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015