Java tutorial
//package com.java2s; public class Main { public static String addQuote(String value) { StringBuilder str = new StringBuilder(); if (null == value) { return null; } str.append("\'").append(value).append("\'"); return str.toString(); } public static String toString(Object obj) { if (null == obj) { return ""; } return obj.toString(); } public static String toString(Object obj, String defaultStr) { if (null == obj) { return defaultStr; } return obj.toString(); } }