split function in java script
-
var abc = "12/12/2000"; var def = abc.split("/"); alert(def.length); it is ok so far what is the problem now for(int i=0;i
-
var abc = "12/12/2000"; var def = abc.split("/"); alert(def.length); it is ok so far what is the problem now for(int i=0;i
Split returns an array of string .... problem is in 2 nd line !!!!
Thanks, Arindam D Tewary
-
Split returns an array of string .... problem is in 2 nd line !!!!
Thanks, Arindam D Tewary
if i write alert(abc[0]); it is working fine. What's the problem in loop then?
Soniagupta1@yahoo.co.in Yahoo Messenger Id = soniagupta1
-
if i write alert(abc[0]); it is working fine. What's the problem in loop then?
Soniagupta1@yahoo.co.in Yahoo Messenger Id = soniagupta1
try ... var abc = "12/12/2000"; var def = abc.split("/"); alert(def.length); it is ok so far what is the problem now for(int i=0;ilength-1;i++) { alert(def[i]); }
Thanks, Arindam D Tewary
-
var abc = "12/12/2000"; var def = abc.split("/"); alert(def.length); it is ok so far what is the problem now for(int i=0;i
-
if i write alert(abc[0]); it is working fine. What's the problem in loop then?
Soniagupta1@yahoo.co.in Yahoo Messenger Id = soniagupta1
Hi sonia, To split a string, use the substring method: string.substring(start,end) Here string is the string from which you want to extract a substring. start is the number specifying the position of the character at which the substring begins. (The character at start itself will be included in the substring.) end is the number specifying the position of the character at which the substring ends. (The character at end will not be included in the substring.) Note that the first character in the string corresponds to position 0, and the last character to position string.length-1. Examples: 'Hello'.substring(0,2) // 'He' 'Hello'.substring(0,4) // 'Hell' Regards, S.Arif patel.