Here you can find the source of splitSQL(List
static void splitSQL(List<String> list, String sql)
//package com.java2s; import java.util.List; public class Main { static void splitSQL(List<String> list, String sql) { int idx = 0; int start = 0; boolean isVar = false; while (idx < sql.length()) { char c = sql.charAt(idx); if (c == '@') { if (idx > start) { list.add(sql.substring(start, idx)); }// w w w .j a va 2s.c om start = idx; isVar = true; } else if (isVar && !isValidName(c)) { if (idx > start) { list.add(sql.substring(start, idx)); } start = idx; isVar = false; } idx++; } if (start < sql.length()) { list.add(sql.substring(start)); } } private static boolean isValidName(char c) { switch (c) { case '.': case '_': case '?': return true; default: return Character.isLetterOrDigit(c); } } }