Hesham
Best I can suggest is to do some Goggling and see if you can find an implementation of such a thing, or painfully write your own.
The problem becomes what happens when you move past English characters? Even simple accented characters, let alone glyphs from other languages. The answer to this may depend on what the potential use of your application is an whether it needs to be internationalized.
Henry Wong wrote:Why would you really need google for this? It's pretty easy to write a comparator that does this. In fact, I just wrote it during lunch -- and it took 10 minutes.
Paul Clapham wrote:
Henry Wong wrote:Why would you really need google for this? It's pretty easy to write a comparator that does this. In fact, I just wrote it during lunch -- and it took 10 minutes.
Are you saying that you rewrote the existing Comparator String.CASE_INSENSITIVE_ORDER?
Hesham
If i understand you well Henry, you mean something like this :
But you need to do the comparison on a character basis
Hesham
anandhi mohan wrote:try this
compare method Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
If you want to get the output in same order as input then you have to override the compare method that will always return 1.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Hesham
Rob Prime wrote:Never ever ever return a constant from compare.
SCJP 1.4, SCWCD 5, SCBCD 5, OCPJWSD 5,SCEA-1, Started Assignment Part 2
My blog- http://rkydesigns.blogspot.com
SCJP 1.4, SCWCD 5, SCBCD 5, OCPJWSD 5,SCEA-1, Started Assignment Part 2
My blog- http://rkydesigns.blogspot.com
Amandeep Singh wrote:
Rob Prime wrote:Never ever ever return a constant from compare.
Rob i am using this code, to sort Object properties, so i am returning constants here.
Is it this a bad idea ?
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |