Java String Quote quote(String str)

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

Description

Quote the given String with single quotes.

License

Open Source License

Parameter

Parameter Description
str the input String (e.g. "myString")

Return

the quoted String (e.g. "'myString'"), or null if the input was null

Declaration

public static String quote(String str) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*  w ww.  java2 s. c om*/
     * Quote the given String with single quotes.
     * @param str the input String (e.g. "myString")
     * @return the quoted String (e.g. "'myString'"),
     * or <code>null<code> if the input was <code>null</code>
     */
    public static String quote(String str) {
        return (str != null ? "'" + str + "'" : null);
    }
}

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)