| 393 | */ |
| 394 | // This is visible for testing. |
| 395 | String replaceAll(String src, final String repl) { |
| 396 | return replaceAllFunc( |
| 397 | src, |
| 398 | new ReplaceFunc() { |
| 399 | @Override |
| 400 | public String replace(String orig) { |
| 401 | return repl; |
| 402 | } |
| 403 | }, |
| 404 | 2 * src.length() + 1); |
| 405 | // TODO(afrozm): Is the reasoning correct, there can be at the most 2*len +1 |
| 406 | // replacements. Basically [a-z]*? abc x will be xaxbcx. So should it be |
| 407 | // len + 1 or 2*len + 1. |
| 408 | } |
| 409 | |
| 410 | /** |
| 411 | * Returns a copy of {@code src} in which only the first match for this regexp has been replaced |