?
? ? ? ? ? ? ? ?//查找某个字符在字符串中的各个位置记录
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[count];
? ? ? ? int index = 0;
? ? ? ? for(int idx = 0; (idx = sql.indexOf("{", idx)) != -1; idx += "{".length()){
? ? ? ?indexs[index++] = idx;
??}
? ? ? ? for(int i:indexs){
? ? ? ?System.out.println("----------- index = " + i);
? ? ? ?}
?
?