zoukankan      html  css  js  c++  java
  • 把数组转换成sql中能使用的字符串

    1、数组对象转换成字符串,拼接成符合sql语句的语法

    2、代码如下例子

      public static void testString(){
            String[] str=new String[]{"a","b","c","d","e"};
            String acc = null;
            for (int i = 0; i < str.length; i++) {
                
                acc=acc+"'"+str[i]+"'"+",";
                
            }
            acc=acc.substring(4, 23);
            System.out.println("拼接的字符串为:"+acc);
            
        }

    3、结果为:

     拼接的字符串为:'a','b','c','d','e'

      

  • 相关阅读:
    知识加油站
    markdown 使用
    今日计划
    继续继续
    我回来了
    2020/5/8
    2020/5/10
    明天一定要学习了
    入驻博客园
    this is a test
  • 原文地址:https://www.cnblogs.com/xijin-wu/p/5783854.html
Copyright © 2011-2022 走看看