Java String Double Quote doubleQuotes(final String s)

Here you can find the source of doubleQuotes(final String s)

Description

Returns a string with double quotes at the beginning and at the end of the string.

License

LGPL

Parameter

Parameter Description
s the string

Return

a string with double quotes at the beginning and at the end of the string or null if s is null

Declaration

public static String doubleQuotes(final String s) 

Method Source Code

//package com.java2s;
/*/*  w  w w.  ja  va 2 s.c o  m*/
 *                  Eoulsan development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public License version 2.1 or
 * later and CeCILL-C. This should be distributed with the code.
 * If you do not have a copy, see:
 *
 *      http://www.gnu.org/licenses/lgpl-2.1.txt
 *      http://www.cecill.info/licences/Licence_CeCILL-C_V1-en.txt
 *
 * Copyright for this code is held jointly by the Genomic platform
 * of the Institut de Biologie de l'?cole normale sup?rieure and
 * the individual authors. These should be listed in @author doc
 * comments.
 *
 * For more information on the Eoulsan project and its aims,
 * or to join the Eoulsan Google group, visit the home page
 * at:
 *
 *      http://outils.genomique.biologie.ens.fr/eoulsan
 *
 */

public class Main {
    /**
     * Returns a string with double quotes at the beginning and at the end of the
     * string.
     * @param s the string
     * @return a string with double quotes at the beginning and at the end of the
     *         string or null if s is null
     */
    public static String doubleQuotes(final String s) {

        if (s == null) {
            return null;
        }

        return '"' + s + '"';
    }
}

Related

  1. doubleQuotedString(String str)
  2. doublequoteEncode(String str)
  3. doubleQuoteIfNecessary(String string)
  4. doubleQuoteIfNotNull(String str)
  5. doubleQuotes(CharSequence stringToDoubleQuote, boolean escapeDoubleQuote)