http://www.leftworld.net/online/j2sedoc/javaref/java.util.stringtokenizer_dsc.htm
StringTokenizer 类允许一个应用把字符串分解成一个个标记。标记化方法比 StreamTokenizer
类使用的方法简单的多。 StringTokenizer
方法不区分标识符、数字和引用字符串,它们也不识别和跳过注释。
下面是一个使用 tokenizer 的例子。代码:
StringTokenizer st = new StringTokenizer("this is a test");
while (st.hasMoreTokens()) {
println(st.nextToken());
}
打印下列输出结果:
this
is
a
test
通过编码找名称:
<tr>
<td align="left" bgcolor="#ececf4">丙方单位</td>
<td colspan="3" align="left" bgcolor="#FFFFFF">
<%
String gs_bfs="";
if(!CM.getAttrValue("gs_bf").equals("")){
String tmpStr="";
StringTokenizer Str = new StringTokenizer(CM.getAttrValue("gs_bf"),",");
while(Str.hasMoreTokens()){
sql="select dwmc from HT_DW where dw_code='" + Str.nextToken() + "'";
rsVector1 = CCommonDAO.select(sql,"ESYSDATACON");
if(rsVector1.size()>0){
CM1=(CommonModel)rsVector1.elementAt(0);
tmpStr =CM1.getAttrValue("dwmc");
}
gs_bfs +=tmpStr+",";
}
out.println(gs_bfs.substring(0,gs_bfs.lastIndexOf(",")));
}
if(!gs_bf_mc.equals("")){
gs_bfs=gs_bf_mc;
out.println(gs_bfs);
}
%>
</td>
</tr>