How to replace first occurrence of string in Java

You can use replaceFirst(String regex, String replacement) method of String.

Leave a Comment