Here you can find the source of quote(String s)
"(null)"
if it is null
.
Parameter | Description |
---|---|
s | the input string, or <code>null</code>. |
s != null
the quoted string, otherwise the string "(null)"
.
public static String quote(String s)
//package com.java2s; public class Main { /**//from www.j a va2s. c o m * Quotes the specified string, or returns <code>"(null)"</code> if it is * <code>null</code>. * * @param s * the input string, or <code>null</code>. * * @return * if <code>s != null</code> the quoted string, otherwise the string * <code>"(null)"</code>. */ public static String quote(String s) { if (s != null) { String quoted = '"' + s + '"'; return quoted; } else { return "(null)"; } } /** * Quotes the textual presentation (returned by <code>toString()</code>) of * the specified object, or returns <code>"(null)"</code> if the object is * <code>null</code>. * * @param o * the object, or <code>null</code>. * * @return * if <code>o != null</code> then <code>o.toString()</code> quoted, * otherwise the string <code>"(null)"</code>. * * @since XINS 1.0.1 */ public static String quote(Object o) { String s = (o == null) ? null : o.toString(); return quote(s); } }