Java String Double Quote doubleQuote(String str)

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

Description

double Quote

License

Mozilla Public License

Declaration

public static String doubleQuote(String str) 

Method Source Code

//package com.java2s;
/**//from   w  w  w.  ja v  a 2  s.  com
 SpagoBI, the Open Source Business Intelligence suite
    
 Copyright (C) 2012 Engineering Ingegneria Informatica S.p.A. - SpagoBI Competency Center
 This Source Code Form is subject to the terms of the Mozilla Public
 License, v. 2.0. If a copy of the MPL was not distributed with this file,
 You can obtain one at http://mozilla.org/MPL/2.0/.
     
**/

public class Main {
    public static String doubleQuote(String str) {
        return quote(str, '"');
    }

    /**
     * Inserts a given character at the beginning and at the end of the specified string.
     * For example if the string is <tt>extreme</tt> and the char is <tt>'</tt> then 
     * the returned string is <tt>'exterme'</tt>.
     */
    public static String quote(String str, char c) {

        assert (str != null);
        StringBuffer buffer = new StringBuffer(str.length() + 2);
        buffer.append(c);
        buffer.append(str);
        buffer.append(c);
        return buffer.toString();
    }
}

Related

  1. doubleQuote(String data)
  2. doubleQuote(String input)
  3. doubleQuote(String message)
  4. doubleQuote(String s)
  5. doubleQuote(String s)
  6. doubleQuote(String str)
  7. doublequote(String str, boolean escapeHtml)
  8. doubleQuote(String string)
  9. doubleQuote(String value)