Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

rules = "(The(code(project)))";

var parent = rules.split("(");


The split function splits all the words separated by "(" an open brace and stores all the words in an array,..
array = [The,code,project)))]
it stores in the above fashion.

I need the Split function to split only the first word i.e "The" into 1 word and "code(project)))" into other word..
Is it possible in Javascript?

Please let me know..
Thanks in advance

Regards,
Swathi
Posted

SwathiSambaraj wrote:
I need the Split function to split only the first word i.e "The" into 1 word and "code(project)))" into other word..
Is it possible in Javascript?

Yes!

You need a custom action so you won't be able to use standard methods lke split or so. Just explicitly declare a variable, find the word between first two braces and store that in arrays 0th position and the text after second brace into 1st position. Done!
 
Share this answer
 
bujji i know java.. il tel u ...
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900