RFR: 8347027: String replaceAll with Function<String, String>

Roger Riggs rriggs at openjdk.org
Tue May 20 19:01:54 UTC 2025


On Tue, 20 May 2025 16:59:10 GMT, kieran-farrell <duke at openjdk.org> wrote:

> New API to the String.java class - replaceAllMapped(String, Function<MatchResult, String>) that allows regex based replacement via a user defined function allowing dynamic replacemnt based on the match. It delegates to the already existing Pattern.matcher().replaceAll(Function).

Since its implemented as 1-one function, it doesn't add much value and requires recompiling the regex on each use.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/25335#issuecomment-2895499907


More information about the core-libs-dev mailing list