Java String Quote quote(String text)

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

Description

quote

License

Open Source License

Declaration

public static String quote(String text) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2004-2010 Sunil Kamath (IcemanK).
 * All rights reserved./*w w  w.ja  va 2 s  .  c  o  m*/
 * This program is made available under the terms of the Common Public License
 * v1.0 which is available at http://www.eclipse.org/legal/cpl-v10.html
 *
 * Contributors:
 *     Sunil Kamath (IcemanK) - initial API and implementation
 *
 *******************************************************************************/

public class Main {
    public static String quote(String text) {
        return new StringBuffer("\"").append(text).append("\"").toString(); //$NON-NLS-1$ //$NON-NLS-2$
    }

    public static String toString(Object object, String defaultValue) {
        if (object == null) {
            return defaultValue;
        } else {
            return object.toString();
        }
    }
}

Related

  1. quote(String string, String charsToQuote)
  2. quote(String string, StringBuilder w)
  3. quote(String tableName)
  4. quote(String text)
  5. quote(String text)
  6. quote(String text)
  7. quote(String text)
  8. quote(String text)
  9. quote(String text, String quote)