数据库
首页 > 数据库> > js如何将数组转换成SQL可以处理的字符串

js如何将数组转换成SQL可以处理的字符串

作者:互联网

//数组为Array [ "AI", "INPUT", "MI", "OOB" ]

 String[] str=new String[]{"AI", "INPUT", "MI", "OOB"};

 String result1= "";

for (i = 0; i < array.length; i++) {

result1 = result1 + "'" + array[i] + "'" + ",";//此操作后的result1=“'AI','INPUT','MI','OOB',”

}


result1 = result1.substring(0, result1.length - 1); //此操作后的result1=“'AI','INPUT','MI','OOB'”(去掉最后一位字符)

标签:转换成,String,OOB,AI,MI,result1,SQL,INPUT,js
来源: https://www.cnblogs.com/Sheldon180621/p/14360307.html