private static int getCount(String str, String key) {
if (str == null || key == null || "".equals(str.trim()) || "".equals(key.trim())) {
return 0;
}
int count = 0;
int index = 0;
while ((index = str.indexOf(key, index)) != -1) {
index = index + key.length();
count++;
}
return count;
}