Java tutorial
//package com.java2s; public class Main { public static String setStringNotNull(String stringRes) { if (stringRes == null || stringRes.isEmpty()) { return ""; } //Convert Non_breaking (ASCI 160) to Simple Space. trim() does'nt handle it. stringRes = stringRes.replace(String.valueOf((char) 160), " "); String tempString = stringRes.trim(); return tempString; } }