Java String Char Count countChar(String sql, int end)

Here you can find the source of countChar(String sql, int end)

Description

count Char

License

Open Source License

Declaration

private static int countChar(String sql, int end) 

Method Source Code

//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;
    }
}

Related

  1. countChar(String s, char c)
  2. countChar(String s, char c)
  3. countChar(String s, char c)
  4. countChar(String src, char c)
  5. countChar(String str, char c)
  6. countChar(String str, char c)
  7. countChar(String str, char chr)