Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
  1. #16
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,772
    Thanks
    55
    Thanked 518 Times in 515 Posts
    I suspect I don't get it, but are you talking about splitting a string wherever there is a space?

    Code:
    str="fresh frozen Damaged Unknown"
    arr=str.split(" ")
    for(var x = 0; x<arr.length; x++){
     alert(arr[x])
    		}
    </script>
    Last edited by xelawho; 01-09-2012 at 03:09 AM.

  2. #17
    New Coder
    Join Date
    Dec 2011
    Posts
    17
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Hi xelawho i needed to do this.

    Code:
    var List = new Array();  // new array
    		List =  String.split('\n') ;  // split at \n
    //		console.log(String);
    //		console.log(List);
    	
    	// join the list
    	var arr = List;
    	var List1 = '\"' + arr.join('\"\n\"') + '\"';	
    //  the List data is now in the format needed


 
Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •