Here you can find the source of countChar(String sql, int end)
private static int countChar(String sql, int end)
//package com.java2s; //License from project: Open Source License public class Main { private static int countChar(String sql, int end) { int count = 0; boolean skipChar = false; for (int i = 0; i < end; i++) { if (sql.charAt(i) == '\'' && !skipChar) { count++;/*ww w .ja v a 2 s . c om*/ skipChar = false; } else if (sql.charAt(i) == '\\') { skipChar = true; } else { skipChar = false; } } return count; } }