Click to See Complete Forum and Search --> : Extract SubString


viresh.madan
03-14-2007, 02:58 AM
I have a String say (hi,hello,how,are,you).. out of this string i want to seperate the string and make 5 string out of it.. they will be

hi
hello
how
are
you

I want to scan the string and find different strings seperated by (,).

Thnx

javula
03-14-2007, 06:48 AM
For example:
String mystring = {hi,hello,bye,...};
String[] separateString = mystring.split(",");

And your separate strings will be in separateString.
In [I]split(String regex) regular expression you can place whichever symbol you need to separate the strings.

purushothamdk
03-14-2007, 06:51 AM
function Newone()
{
var msg="Hai,new,one,two";
var aa=new Array();
aa=msg.split(",");
var i;
for(i=0;i<aa.length;i++)
{
alert(aa[i]);
}
}

agent_x91
03-14-2007, 06:58 AM
Wrong forum puru. This is the Java Forum, not the JavaScript forum; as the title says very clearly.