Class JavaStringEscapes

java.lang.Object
org.openrewrite.java.logging.internal.JavaStringEscapes

public final class JavaStringEscapes extends Object
  • Method Details

    • escapeJavaStringContent

      public static String escapeJavaStringContent(String value)
      Escapes a decoded String value so it can be placed verbatim between the double quotes of a Java string literal. Printable characters, including non-ASCII text such as café or emoji, are left untouched; only the characters that would otherwise produce invalid or unreadable source are escaped.
      Parameters:
      value - the decoded string value (escape sequences already resolved to their characters)
      Returns:
      the escaped literal content, without surrounding quotes