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

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

Posts: 18
Registered: ‎02-03-2010
My Device: Blackberry Storm - 9570
My Carrier: Tim
Accepted Solution



Im trying to do a search, RIM SDK dont have String.contains().

I need to do anything like this:


i have a list with many names like Jonh Man, Sesame Road, Mary Jane...


The user inputs: ROAD = userInput


i return all words with road, like:


Sesame Road myWord[0]

Long Road myWord[1]

Road Test ...

St. Street Road..


how i can compare user input with my vector words?


if i had contains, i would do something like this... 







Posts: 159
Registered: ‎08-19-2008
My Device: Not Specified

Re: String.contains()

Use string.indexOf("word",0).............if it returns > 0 then u can add it to vector myWord otherwise not..............

Posts: 18
Registered: ‎02-03-2010
My Device: Blackberry Storm - 9570
My Carrier: Tim

Re: String.contains()

thx, that works XD

Posts: 17,026
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: String.contains()

only as a sidenote, use >-1. 0 is a valid index.

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Posts: 455
Registered: ‎01-14-2009
My Device: Apple iPhone 3GS 16GB

Re: String.contains()

Feel free to use this method



   public static boolean contains(String fullString, String searchedString) {
                try {
                        if (fullString.toLowerCase().indexOf(searchedString.toLowerCase()) != -1)
                                return true;
                } catch (Exception e) {
                        return false;
                return false;