Click here to Skip to main content
15,749,352 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
dear sir,
var bookedSeats = [];
this is my array and i have 1 string variable like string seat_no="1,2,3,4";
i want to pass this string value in to bookedSeat.
i want to do like- bookedSeat=[1,2,3,4];
plz help...

var seat_no = "1,2,3,4";
var bookedSeats = seat_no.split(",");
Share this answer
Rajkumar_007 27-Mar-14 8:11am    
but bookedSeats is the array variable....
Kornfeld Eliyahu Peter 27-Mar-14 8:13am    
And split creates array out of string...
string seat_no = "1,2,3,4";
var bookedSeats = seat_no.split(",");
string[] bookedSeatsA=seat_no.split(",");
Share this answer

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