| 发表于:2007-07-09 16:56:0411楼 得分:0 |
谢谢各位的热心解答,我改了一下,可以实现三格方式的任意组合,代码分享一下: //格式化标题 public static string str(string title) { str(title, null, false); return title; } public static string str(string title, string color) { str(title, color, false); return title; } public static string str(string title, bool isbold) { str(title, null, isbold); return title; } public static string str(string title, string color, bool isbold) { if (title.length > 15) { title = title.substring(0, 15) + ".. "; } if (!string.isnullorempty(color)) { title = " <font color= ' " + color + " '> " + title + " </font> "; } if (isbold == true) { title = " <b> " + title + " </b> "; } return title; } | | |
|