Java tutorial
//package com.java2s; public class Main { private static final String SPLITER = ","; public static String removeFromCollection(String collectionString, String content) { String[] elements = collectionString.split(SPLITER); StringBuilder builder = new StringBuilder(); for (String element : elements) { if (element.equals(content)) { continue; } builder.append(element).append(","); } if (builder.length() > 0) { builder.deleteCharAt(builder.lastIndexOf(",")); } return builder.toString(); } }