groovy array remove the brackets

前端 未结 2 1601
忘了有多久
忘了有多久 2021-01-17 06:39
  def colarray=[]
                    def num
                    def newRole = rolecol.split(\',\')
                    def len = newRole.size()
                            


        
相关标签:
2条回答
  • 2021-01-17 07:14
    def colarray = rolecol.tokenize(',').collect { "col$it" }.join(', ')
    

    Then you will also need to escape your sql:

    sql.eachRow("select col01, ${Sql.expand(colarray)} from read_csv where col01 = ? and ${Sql.expand('col' + usercol)} != ? ", [file.name,""])
    
    0 讨论(0)
  • 2021-01-17 07:34

    the [] are there, because you are doing an implicit toString on the list. use colarray.join(',')

    0 讨论(0)
提交回复
热议问题