Java String Quote quote(String str)

Here you can find the source of quote(String str)

Description

Returns the given string enclosed with quotation marks.

License

Open Source License

Parameter

Parameter Description
str string to quote

Exception

Parameter Description
NullPointerExceptionif str is null

Return

quoted string

Declaration

public static String quote(String str) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from   ww w.j a va  2 s . c o m*/
     * Returns the given string enclosed with quotation marks.
     *
     * @param str string to quote
     * @return quoted string
     * @throws NullPointerException  if {@code str} is {@code null}
     */
    public static String quote(String str) {
        return '"' + str.toString() + '"';
    }
}

Related

  1. quote(String str)
  2. quote(String str)
  3. quote(String str)
  4. quote(String str)
  5. quote(String str)
  6. quote(String str)
  7. quote(String str)
  8. quote(String str)
  9. quote(String str)