Java String Quote quote(String string)

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

Description

This function puts '"' around

License

Open Source License

Parameter

Parameter Description
string and returns it, if it's not empty and not null; else it returns the string 'null'.

Return

No description provided

Declaration

public static String quote(String string) 

Method Source Code

//package com.java2s;
/*//from  w w w . j  av  a2 s  .  c o  m
 * The FUJABA ToolSuite project:
 *
 *   FUJABA is the acronym for 'From Uml to Java And Back Again'
 *   and originally aims to provide an environment for round-trip
 *   engineering using UML as visual programming language. During
 *   the last years, the environment has become a base for several
 *   research activities, e.g. distributed software, database
 *   systems, modelling mechanical and electrical systems and
 *   their simulation. Thus, the environment has become a project,
 *   where this source code is part of. Further details are avail-
 *   able via http://www.fujaba.de
 *
 *      Copyright (C) Fujaba Development Group
 *
 *   This library is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU Lesser General Public
 *   License as published by the Free Software Foundation; either
 *   version 2.1 of the License, or (at your option) any later version.
 *
 *   You should have received a copy of the GNU Lesser General Public
 *   License along with this library; if not, write to the Free
 *   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *   MA 02111-1307, USA or download the license under
 *   http://www.gnu.org/copyleft/lesser.html
 *
 * WARRANTY:
 *
 *   This library is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *   GNU Lesser General Public License for more details.
 *
 * Contact address:
 *
 *   Fujaba Management Board
 *   Software Engineering Group
 *   University of Paderborn
 *   Warburgerstr. 100
 *   D-33098 Paderborn
 *   Germany
 *
 *   URL  : http://www.fujaba.de
 *   email: info@fujaba.de
 *
 */

public class Main {
    /**
     * This function puts '"' around
     * 
     * @param string and returns it, if it's not empty and not null; else it returns the string 'null'.
     * @return No description provided
     */
    public static String quote(String string) {
        if (string != null && string.length() != 0) {
            return "\"" + string + "\"";
        } else {
            return "null";
        }
    }
}

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)
  9. quote(String string)