(String s, String text, String delimiter)
| 44 | public class StringUtil { |
| 45 | |
| 46 | public static boolean contains(String s, String text, String delimiter) { |
| 47 | if ((s == null) || (text == null) || (delimiter == null)) { |
| 48 | return false; |
| 49 | } |
| 50 | |
| 51 | if (!s.endsWith(delimiter)) { |
| 52 | s += delimiter; |
| 53 | } |
| 54 | |
| 55 | int pos = s.indexOf(delimiter + text + delimiter); |
| 56 | |
| 57 | if (pos == -1) { |
| 58 | if (s.startsWith(text + delimiter)) { |
| 59 | return true; |
| 60 | } |
| 61 | |
| 62 | return false; |
| 63 | } |
| 64 | |
| 65 | return true; |
| 66 | } |
| 67 | |
| 68 | public static int count(String s, String text) { |
| 69 | if ((s == null) || (text == null)) { |
no test coverage detected