Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 224
Registered: ‎03-29-2012
My Device: 9900
My Carrier: Wind

compareTo() method but IgnoreCase

Hey all, I need to use the compareTo() method to compare two strings and return a + or - value based on which one comes first alphabetically. This all works well in java using compareToIgnoreCase() but this is not build into the BB code, how can I implement this in Blackberry? I am sure there must be something built in for something so essential. As always, thanks guys.

Developer
Posts: 729
Registered: ‎05-04-2011
My Device: 9700

Re: compareTo() method but IgnoreCase

Just use: a.toLowerCase(0.compareTo(b.toLowerCase());

 

Or use the StringUtil:

http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/util/StringUtilities.html#comp...

 

E.