org.apache.commons.text

## Class StringEscapeUtils.Builder

- java.lang.Object
- - org.apache.commons.text.StringEscapeUtils.Builder

- Enclosing class:
    StringEscapeUtils

      public static final class StringEscapeUtils.Builder
      extends Object

  Convenience wrapper for `StringBuilder` providing escape methods.

  Example:

       new Builder(ESCAPE_HTML4)
            .append("<p>")
            .escape("This is paragraph 1 and special chars like & get escaped.")
            .append("</p><p>")
            .escape("This is paragraph 2 & more...")
            .append("</p>")
            .toString()

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `StringEscapeUtils.Builder` | `append(String input)` Literal append, no escaping being done.
    `StringEscapeUtils.Builder` | `escape(String input)` Escape `input` according to the given `CharSequenceTranslator`.
    `String` | `toString()` Return the escaped string.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### escape

          public StringEscapeUtils.Builder escape(String input)

      Escape `input` according to the given `CharSequenceTranslator`.

      Parameters:
        `input` - the String to escape
      Returns:
        `this`, to enable chaining

    - #### append

          public StringEscapeUtils.Builder append(String input)

      Literal append, no escaping being done.
      Parameters:
        `input` - the String to append
      Returns:
        `this`, to enable chaining

    - #### toString

          public String toString()

      Return the escaped string.

      Overrides:
        `toString` in class `Object`
      Returns:
        the escaped string

Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.