I have a String array that contains the "_" characheter in each element of it, I want to get rid of these characters.
I can do this task simply by using String [] split(String regex) method, but I don't want to it by this function because I will use this code in J2ME later.
I have write a code to do this task but the output are strange characters [Ljava.lang.String;@19821f [Ljava.lang.String;@addbf1 !!!
public class StringFragementation {
static public String [] mymethod(String [] mystring)
{
String ss [] =new String[mystring.length];
for(int j=0;j<mystring.length;j++)
{
ss[j] = mystring[j].replace('_',',');
}
return ss ;
}
public static void main(String [] args)
{
String [] s = {"Netherlands_Iceland_Norway_Denmark","Usa_Brazil_Argentina"};
for(int i=0;i<s.length;i++)
{
System.out.println("" + mymethod(s) );
}
}
}