当前位置: 技术问答>java相关
我用java做的applet站内搜索程序,不能搜索中文,那位大虾能帮帮我?代码如下:
来源: 互联网 发布时间:2014-12-30
本文导语: boolean match(String s, String s1) { String s2 = s.toLowerCase(); //String s2=getstr(s); String s3 = s1.toLowerCase(); //String s3=getstr(s1); for(StringTokenizer stringtokenizer = n...
boolean match(String s, String s1)
{
String s2 = s.toLowerCase();
//String s2=getstr(s);
String s3 = s1.toLowerCase();
//String s3=getstr(s1);
for(StringTokenizer stringtokenizer = new StringTokenizer(s2, ", ", false); stringtokenizer.hasMoreTokens();)
if(s3.indexOf(stringtokenizer.nextToken()) != -1)
return true;
return false;
}
{
String s2 = s.toLowerCase();
//String s2=getstr(s);
String s3 = s1.toLowerCase();
//String s3=getstr(s1);
for(StringTokenizer stringtokenizer = new StringTokenizer(s2, ", ", false); stringtokenizer.hasMoreTokens();)
if(s3.indexOf(stringtokenizer.nextToken()) != -1)
return true;
return false;
}
|
use javac -encoding GBK javafile
boolean match(String s, String s1)
{
String s2 = s.toLowerCase();
//String s2=getstr(s);
String s3 = s1.toLowerCase();
//String s3=getstr(s1);
for(StringTokenizer stringtokenizer = new StringTokenizer(s2, ", ", false); stringtokenizer.hasMoreTokens();)
if(stringtokenizer.nextToken().indexOf(s3) != -1)
return true;
return false;
}
boolean match(String s, String s1)
{
String s2 = s.toLowerCase();
//String s2=getstr(s);
String s3 = s1.toLowerCase();
//String s3=getstr(s1);
for(StringTokenizer stringtokenizer = new StringTokenizer(s2, ", ", false); stringtokenizer.hasMoreTokens();)
if(stringtokenizer.nextToken().indexOf(s3) != -1)
return true;
return false;
}