i have one String[]
String[] name = {\"amit\", \"rahul\", \"surya\"};
i want to send name as parameter in sql query inside IN
here is a Utility method to split an array and put your custom delimiter, using
String.replace(String,String)
Arrays.toString(Object[])
here it is :
public static String toString(String delimiter, Object[]array){
String s = "";
// split array
if (array != null && array.length > 0) {
s = Arrays.toString(array).replace("[", "").replace("]", "");
}
// place delimiter (notice the space in ", ")
if(delimiter != null){
s = s.replace(", ", delimiter);
}
return s;
}
change the second argument type to suite your array type