By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,398 Members | 1,372 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,398 IT Pros & Developers. It's quick & easy.

how to split the array value

kaleeswaran
100+
P: 132
Hi!
i stored the string value inside my array like "1,username"
so i have to split the value user name and serial number.

the array is:
Expand|Select|Wrap|Line Numbers
  1.                for(index=0; index < data.length; index++)
  2.                  {
  3.                     dataSource.addRowItem(data[index].id,data[index]);  
  4.                 }
  5.  
now i want to split the row items inside the array.how to do that...
thank you,
kaleeswaran
Nov 15 '07 #1
Share this Question
Share on Google+
5 Replies


acoder
Expert Mod 15k+
P: 16,027
If data is the array,
Expand|Select|Wrap|Line Numbers
  1. var splitArr = data[index].split(",");
  2. var serial = serialArr[0];
  3. var uname = serialArr[1];
should give you the values that you need.
Nov 15 '07 #2

kaleeswaran
100+
P: 132
If data is the array,
Expand|Select|Wrap|Line Numbers
  1. var splitArr = data[index].split(",");
  2. var serial = serialArr[0];
  3. var uname = serialArr[1];
should give you the values that you need.
thank for ur reply wat is seralArr[] in this...
Nov 15 '07 #3

acoder
Expert Mod 15k+
P: 16,027
thank for ur reply wat is seralArr[] in this...
Sorry, that was a mistake. I meant splitArr[]
Nov 15 '07 #4

kaleeswaran
100+
P: 132
thank you, i got it...
Nov 16 '07 #5

acoder
Expert Mod 15k+
P: 16,027
You're welcome. Glad you got it working.
Nov 16 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.