Created
September 25, 2023 13:33
-
-
Save SoltauFintel/390c281e72cad76a944ee269f9dfe585 to your computer and use it in GitHub Desktop.
non case-sensitive replace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* non case-sensitive replace() | |
* @param text to be changed text | |
* @param alt this text is to be replaced | |
* @param neu replace by this text | |
* @return text with replaced alt | |
*/ | |
public static String ireplace(final String text, final String alt, final String neu) { | |
return text.replaceAll("(?i)" + alt.replace("{", "\\{").replace("}", "\\}"), neu); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment