Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

dojo script to find the substring

 Hi All,

Can someone help me on how to find whether a given string contains a specific sub-string.

here is my scenario,
I have written a Script based condition where I`m reading the value of an attribute(Multi select). here when i select multiple values I`m getting a string with comma separated values but i want to know whether the user selected the option which I`m interested in.

Thanks
Surender





0 votes



2 answers

Permanent link
You should refer to the Dojo documentation: http://dojotoolkit.org/reference-guide/1.10/dojo/string.html#dojo-string

0 votes


Permanent link
I suppose you have a JavaScript String object, not necessarily a Dojo String object. In this case, either the indexOf() or the search() function should work for you.
http://www.w3schools.com/jsref/jsref_indexof.asp
http://www.w3schools.com/jsref/jsref_search.asp
Another approach is to split the string using comma as the separator. Then you can check whether any item in the resulting array is a match.
http://www.w3schools.com/jsref/jsref_split.asp

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,927

Question asked: Aug 06 '14, 1:07 p.m.

Question was seen: 5,289 times

Last updated: Aug 07 '14, 12:11 a.m.

Confirmation Cancel Confirm