If you can import com.lakota.utils.StringUtils then it's that simple. Import this> import com.lakota.utils.StringUtils;
int count = StringUtils.countMatches("One,Two,Three,Four!", ","); System.out.println("total comma "+ count);
Mahfuz ahmed
source share