Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { private static String buildCondition(String propType) { if (propType == null || propType.trim().length() == 0) { return ""; } String s = " tuv.updated_by_project = '"; StringBuffer sb = new StringBuffer(s); String[] projects = propType.split(","); for (int i = 0; i < projects.length; i++) { if (i == projects.length - 1) { sb.append(projects[i]).append("'"); } else { sb.append(projects[i]).append("'").append(" or ").append(s); } } return sb.toString(); } }