Here you can find the source of quoteIfNeeded(String value)
public static String quoteIfNeeded(String value)
//package com.java2s; //License from project: Apache License public class Main { private static final String SPACE = " "; public static String quoteIfNeeded(String value) { if (value == null) { return null; }//from w ww . ja v a2 s. c om return value.contains(SPACE) ? String.format("'%s'", value) : value; } }