Java tutorial
//package com.java2s; public class Main { /** * Removes all occurrences of the specified stylename in the given style and * returns the updated style. Trailing semicolons are preserved. */ public static String removeStylename(String style, String stylename) { StringBuffer buffer = new StringBuffer(); if (style != null) { String[] tokens = style.split(";"); for (int i = 0; i < tokens.length; i++) { if (!tokens[i].equals(stylename)) { buffer.append(tokens[i] + ";"); } } } return (buffer.length() > 1) ? buffer.substring(0, buffer.length() - 1) : buffer.toString(); } }