Java tutorial
//package com.java2s; public class Main { public static String processAsteriskLabel(String labelString) { if (labelString == null) { return null; } StringBuffer sb = new StringBuffer(""); sb.append("<html><body> "); int index = labelString.lastIndexOf("*"); if (index > -1) { sb.append(labelString.subSequence(0, index)); sb.append("<font color='red'>*</font>"); } else { sb.append(labelString + " "); } sb.append("</body></html>"); return sb.toString(); } }