Java String Quote quote(String string)

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

Description

Add single quotes around the given string.

License

Open Source License

Parameter

Parameter Description
string a parameter

Declaration

public static String quote(String string) 

Method Source Code

//package com.java2s;
/**//from  w  w w.  jav  a  2 s  .  c  o m
 * Aptana Studio
 * Copyright (c) 2005-2012 by Appcelerator, Inc. All Rights Reserved.
 * Licensed under the terms of the GNU Public License (GPL) v3 (with exceptions).
 * Please see the license.html included with this distribution for details.
 * Any modifications to this file must keep this entire header intact.
 */

public class Main {
    /**
     * Add single quotes around the given string.
     * 
     * @param string
     * @return
     */
    public static String quote(String string) {
        return string == null ? null : '\'' + string + '\'';
    }
}

Related

  1. quote(String string)
  2. quote(String string)
  3. quote(String string)
  4. quote(String string)
  5. quote(String string)
  6. quote(String string)
  7. quote(String string)
  8. quote(String string, boolean escapeHtml)
  9. quote(String string, String charsToQuote)