当前位置:编程学习 > JAVA >>

Java后台String类型引号问题

原本代码为这样,我要把它做成动态的数据问题就出现。

{"OBJ_ID","BDZ","YDDW","YDLX","SQRQ","YDRQ","YDYY","YDYJ","YDSB","SBLX","SBXH","DYDJ","TYJG","TYWZ","TYXB","YDQYXZT","YDHYXZT","BZ","CTIME","LMTIME"} ;
   String [] insertupdateStream = {"OBJ_ID","BDZ","YDDW","YDLX","SQRQ","YDRQ","YDYY","YDYJ","YDSB","SBLX","SBXH","DYDJ","TYJG","TYWZ","TYXB","YDQYXZT","YDHYXZT","BZ","CTIME","LMTIME"};
   Boolean[] insertupdateOrNot = {false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true};
 insertUpdateMeta.setUpdateLookup(insertupdatelookup);
   insertUpdateMeta.setUpdateStream(insertupdateStream);
   insertUpdateMeta.setUpdate(insertupdateOrNot);

改变后为这样:
   List list=lcOrclDao.SQLEquBdByOracleTable(kettle_tablename);
    for (Iterator it = list.iterator(); it.hasNext(); ) {
  Map map = (Map)it.next();
       Set set = map.keySet();
       String ziduan = set.toString().substring(1, set.toString().lastIndexOf("]"));
       String[] zifu = ziduan.split(",");
         for(String douhao:zifu){
        tableid+= '"'+douhao+'"'+",";
        if(douhao.equals("id")){
        tableboolean +="false,";
        }else{
        tableboolean +="true,";
        }
       }
  }

String[] insertupdatelookup = {tableid.substring(0, tableid.lastIndexOf(","))} ;
String [] insertupdateStream = {tableid.substring(0, tableid.lastIndexOf(","))};
Boolean[] insertupdateOrNot = {Boolean.valueOf(tableboolean.substring(0,tableid.lastIndexOf(",")))};

我现在想让他自己处理成为"OBJ_ID","BDZ","YDDW","YDLX"。。。这种状态,可是后台因为有 String自带“”不能把数据按照正常情况放在这几个参数里,怎么解决?
java string --------------------编程问答-------------------- 亲,你的语文得好好学学了,我从头至尾看了3遍才看懂。。
你的意思就是

{"OBJ_ID","BDZ","YDDW","YDLX","SQRQ","YDRQ","YDYY","YDYJ","YDSB","SBLX","SBXH","DYDJ","TYJG","TYWZ","TYXB","YDQYXZT","YDHYXZT","BZ","CTIME","LMTIME"};
这样的字符串中提取OBJ_ID吧?
String s[]=str.split(",");
for(String ss:s){
s.substring(1,s.length-1);
} --------------------编程问答-------------------- 不是,我是要把它的数据做成动态的,不是写死的,这个String类型的数据里面包含双引号,并且改变后取出来的数据 在最外层系统默认还有一对引号,导致输出的数据有问题 --------------------编程问答--------------------
引用 1 楼 AA5279AA 的回复:
亲,你的语文得好好学学了,我从头至尾看了3遍才看懂。。
你的意思就是

{"OBJ_ID","BDZ","YDDW","YDLX","SQRQ","YDRQ","YDYY","YDYJ","YDSB","SBLX","SBXH","DYDJ","TYJG","TYWZ","TYXB","YDQYXZT","YDHYXZT","BZ","CTIME","LMTIME"};
这样的字符串中提取OBJ_ID吧?
String s[]=str.split(",");
for(String ss:s){
s.substring(1,s.length-1);
}
--------------------编程问答--------------------  拼接后获取的问题,,自己慢慢试试就搞定了 --------------------编程问答-------------------- 转义。。。。。。。。。。。。。。。。。。。。。。。。 --------------------编程问答-------------------- 用\转译……
补充:Java ,  Java EE
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,