荒村听雨31 发表于 2013-2-3 14:18:45

查找某个字符在字符串中的各个位置记录

 
               //查找某个字符在字符串中的各个位置记录
String sql = " SELECT 1 FROM DUAL WHERE 1=1 AND 2=2 {AND ny = $1} { AND org_no = $2}";

int count = StringUtils.countMatches(sql, "{");
int[] indexs = new int;
        int index = 0;
        for(int idx = 0; (idx = sql.indexOf("{", idx)) != -1; idx += "{".length()){
      indexs = idx;
  }
        for(int i:indexs){
      System.out.println("----------- index = " + i);
       }
 
 
页: [1]
查看完整版本: 查找某个字符在字符串中的各个位置记录