Skip to content

Instantly share code, notes, and snippets.

@NahianAhmed
Created August 3, 2022 03:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NahianAhmed/7956c1af336a97dc7f2049da37b606e8 to your computer and use it in GitHub Desktop.
Save NahianAhmed/7956c1af336a97dc7f2049da37b606e8 to your computer and use it in GitHub Desktop.
Remove Carriage return, Tab , new line in Java
public static String replaceTabAndNewLine(String text, String replacement) {
return StringUtils.isNotBlank(text) ? text.replaceAll("[\\r\\t\\n]", replacement) : StringUtils.EMPTY;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment