(String s, String remove, String delimiter)
| 121 | } |
| 122 | |
| 123 | public static String remove(String s, String remove, String delimiter) { |
| 124 | if ((s == null) || (remove == null) || (delimiter == null)) { |
| 125 | return null; |
| 126 | } |
| 127 | |
| 128 | if (UtilValidate.isNotEmpty(s) && !s.endsWith(delimiter)) { |
| 129 | s += delimiter; |
| 130 | } |
| 131 | |
| 132 | while (contains(s, remove, delimiter)) { |
| 133 | int pos = s.indexOf(delimiter + remove + delimiter); |
| 134 | |
| 135 | if (pos == -1) { |
| 136 | if (s.startsWith(remove + delimiter)) { |
| 137 | s = s.substring(remove.length() + delimiter.length(), s.length()); |
| 138 | } |
| 139 | } else { |
| 140 | s = s.substring(0, pos) + s.substring(pos + remove.length() + delimiter.length(), s.length()); |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | return s; |
| 145 | } |
| 146 | |
| 147 | public static String replace(String s, String oldSub, String newSub) { |
| 148 | if ((s == null) || (oldSub == null) || (newSub == null)) { |
nothing calls this directly
no test coverage detected