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

Web and WebWorks 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: 166
Registered: ‎02-15-2012
My Device: Playbook 16GB
My Carrier: Bags are useful

Splitting and Checking against Javascript array

Hi everyone,


Im struggling with what steps to take even in my algorithm to solve my problem. Here is what I have done so far:


1. I have a text box (form) with the id "message"


2.Im then using this


document.getElementById ('message');


to store that value in the variable called "words"


3.I have then made a new variable straight after:


splitwords = words.split(" ") 


So the message: "Hello world my name is flow"


should now be stored like this


splitwords[0] = "Hello"

splitwords[1] = "world"

splitwords[3] = "my"



First of all am I even doing this correctly?

And if Im not someone help me with how I should tackle the problem is there is one so far.


So here is the actual problem:


I have an array of 10 words. I want to compare all of the splitwords with each word in the array so if thre is a match I can output the words that match. E.g:


If my array contains the words "hello" and splitword[x] contains the words "hello" then the output should be:

Match has been found: Hello


Any help is greatly appreciated,

If you want me to explain more clearly then please ask me to Smiley Happy









If any post helps you please click the Like Button below the post(s) that helped you.
2. Please resolve your thread by marking the post "Solution?" which solved it for you!

Posts: 466
Registered: ‎04-11-2012
My Device: Bold 9900
My Carrier: Rogers

Re: Splitting and Checking against Javascript array

2 ways to check if you got the right words in your variables

easy and painful : put an alert function in

less easy and less painful : put in a text area and have your text output there

PS take note of the overflow you may have if you have 3 words in your string and you try splitwords[3] will return with an error.

Developer for easyDial for BlackBerry Bold & inLink for BlackBerry PlayBook
Find me online via twitter, or on the techfruits.com webpage. Please hit the like button below if what I said helped!