A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
OCM Java EE 6 Enterprise Architect Exam Guide
this week in the
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 7 API documentation
- My blog about Scala
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
subject: Find the lowest string using Java
method construction trouble
what is the trick
saprating strings with commas one by one
how many bytes in char
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014