﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-鸟不生蛋蛋的地方-随笔分类-一般应用</title><link>http://www.blogjava.net/zqc/category/2602.html</link><description>写写一些自己对于java的体会</description><language>zh-cn</language><lastBuildDate>Fri, 02 Mar 2007 02:34:28 GMT</lastBuildDate><pubDate>Fri, 02 Mar 2007 02:34:28 GMT</pubDate><ttl>60</ttl><item><title>Comments on Mock-Based Testing</title><link>http://www.blogjava.net/zqc/archive/2006/06/04/50308.html</link><dc:creator>鸟不生蛋蛋的地方</dc:creator><author>鸟不生蛋蛋的地方</author><pubDate>Sun, 04 Jun 2006 10:53:00 GMT</pubDate><guid>http://www.blogjava.net/zqc/archive/2006/06/04/50308.html</guid><wfw:comment>http://www.blogjava.net/zqc/comments/50308.html</wfw:comment><comments>http://www.blogjava.net/zqc/archive/2006/06/04/50308.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/zqc/comments/commentRss/50308.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zqc/services/trackbacks/50308.html</trackback:ping><description><![CDATA[
		<p>很好的一篇文章，深入说了很多关于测试的东西。<br /><br />A article from Technoetic<a title="Posts by Steve Bate" href="http://blog.technoetic.com/author/steve/"><font color="#000000"><br />- Posted in </font></a><a title="View all posts in Software Dev." href="http://blog.technoetic.com/categories/software-development/" rel="category tag">Software Dev.</a><a title="Posts by Steve Bate" href="http://blog.technoetic.com/author/steve/"><font color="#000000">, </font></a><a title="View all posts in Agile" href="http://blog.technoetic.com/categories/software-development/agile-techniques/" rel="category tag">Agile</a><a title="Posts by Steve Bate" href="http://blog.technoetic.com/author/steve/"><font color="#000000"> by </font></a><a title="Posts by Steve Bate" href="http://blog.technoetic.com/author/steve/"><strong>Steve Bate</strong></a><br /><br />I recently read a blog entry with <a href="http://weblogs.asp.net/jsgreenwood/archive/2004/12/29/343963.aspx">criticisms of mock-based testing</a>. The author raised several “issues” with using mocks to support unit testing. I’m commenting here since the author has closed comments on the original blog entry.</p>
		<p>
				<strong>Issue 1: Poor integration tests, as everything is being tested in isolation</strong>
		</p>
		<p>I’ve had good experience with mock-based testing. However, it’s obvious that mocks will only test classes in isolation. I use both unit tests and integration tests (sometimes called system or acceptance tests) together. The need for integration tests is not an issue for mock-based techniques and is not a good reason to use less mocks. It’s just a different aspect of testing. A more common issue in my experience is that people in the agile community who are new to testing often don’t understand these different aspects of testing and seem to believe that mock-based unit testing and integration testing are mutually exclusive options. The lack of common terminology in the community only worsens the problem. For some people, a “unit” is a class or small group of tightly coupled classes. For others, it’s a large portion of the software product. Most agile developers seem to call every test they write a unit test. It’s become so confusing for some teams that I’ve seen terminology like “integration unit tests” being used to describe testing strategies.</p>
		<p>But, back to the topic. Poor integration testing is simply the result of lack of integration tests. Mocks do not <em>cause</em> a lack of integration tests. A team makes that choice, probably based on a weak understanding of the tradeoffs between isolation (unit) and integration (system) testing.<br /><a id="more-69"></a><br /><strong>Issue 2: Mocks add complexity to the software design.</strong></p>
		<blockquote>
				<p>“I’ve seen numerous occasions where the introduction of mocks has added a large amount of complexity to an otherwise simple design. This complexity leads to higher implementation costs, a higher cognitive load on the developers working on the system, and higher maintenance costs (as there’s more code to maintain). “</p>
		</blockquote>
		<p>The author appears to focused on the increased use of interfaces when using mock-based testing and expresses the opinion that interfaces should only be used where we’d want to be able to replace one implementation with another. First, there are other reasons to use interfaces. In general, interfaces are useful for managing dependencies between software components or subsystems. This can be beneficial even if the implementations do not change (see <a href="http://www.objectmentor.com/resources/articles/dip.pdf">The Dependency Inversion Principle</a>).</p>
		<p>A modular software design will generally make it easier to use mock-based testing <em>without altering the design specifically for the mocks</em>. However, there are times when the software must be modified to support testing. Fortunately, the changes needed to support testing often, if done well, support the modularity goal.</p>
		<p>In my experience, extra interfaces don’t add a significant maintenance overhead. Most effort is spent implementing the interface. The time writing the interface itself (or extracting it using an IDE’s refactoring tools) is negligible.</p>
		<p>
				<strong>My Conclusions</strong>
		</p>
		<p>In almost every case, I see the “simplicity” gained by not using mocks overshadowed by complex test setups to initialize large groups of dependent objects. The dark side of integration testing is that it’s often very slow for large numbers of tests. Some teams are using continuous integration tools like Cruise Control to run their “unit tests” (usually they are actually integration tests). This delays the feedback about broken builds but is often necessary because the tests run so slow. I realize there other reasons for using CC, but this is a common one from what I’ve seen and heard.</p>
		<p>I’ve worked on teams where we had thousands of tests that ran in less than 15-20 seconds total on a developer workstation. This was a direct result of heavy use of mock-based testing. We also had a slower suite of integration tests that required 4-5 minutes to run. We didn’t need a continuous integration server because we were able to integrate and run our unit tests before every commit to the source control system. The team integrated 10-20 times/day and broken builds were practically nonexistent over the several years I worked with them. In the very rare cases when the build did break, it was typically fixed in a matter of minutes.</p>
		<p>The other benefit of the isolation testing enabled by mocks is the ability to pinpoint problems much more quickly. It’s a form of the divide and conquer problem solving strategy, only the divide part is already done. The conquering is relatively easy compared to tracking down the cause of test failures when many classes are being exercised in a test.</p>
		<p>My experience was that our mock based unit tests caught about 98% of the code problems before the code was ever committed to source control. The integration tests caught about another 1% beyond that (almost always because of a flaw in the mock-based testing) and manual testing caught the other 1%. </p>
		<div class="meta" align="right">- Posted in <a title="View all posts in Software Dev." href="http://blog.technoetic.com/categories/software-development/" rel="category tag">Software Dev.</a>, <a title="View all posts in Agile" href="http://blog.technoetic.com/categories/software-development/agile-techniques/" rel="category tag">Agile</a> by <b><a title="Posts by Steve Bate" href="http://blog.technoetic.com/author/steve/">Steve Bate</a></b></div>
<img src ="http://www.blogjava.net/zqc/aggbug/50308.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zqc/" target="_blank">鸟不生蛋蛋的地方</a> 2006-06-04 18:53 <a href="http://www.blogjava.net/zqc/archive/2006/06/04/50308.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用editplus+ant 建立简单好用的工作环境详细步骤</title><link>http://www.blogjava.net/zqc/archive/2005/09/13/EditplusAndAnt.html</link><dc:creator>鸟不生蛋蛋的地方</dc:creator><author>鸟不生蛋蛋的地方</author><pubDate>Tue, 13 Sep 2005 15:25:00 GMT</pubDate><guid>http://www.blogjava.net/zqc/archive/2005/09/13/EditplusAndAnt.html</guid><wfw:comment>http://www.blogjava.net/zqc/comments/12945.html</wfw:comment><comments>http://www.blogjava.net/zqc/archive/2005/09/13/EditplusAndAnt.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/zqc/comments/commentRss/12945.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zqc/services/trackbacks/12945.html</trackback:ping><description><![CDATA[<P><STRONG><FONT style="BACKGROUND-COLOR: #ffffff" size=6>用</FONT></STRONG>了那许多强大专业的IDE，也换换胃口，自己动手配一个简单点的环境~<BR>editplus大家都很熟啦，就用它了(UE也行，，不过大多了)~</P>
<P>假设配置一个Webapp的开发环境:</P>
<P>下载editplus,解压缩、安装到某目录。<BR>建立Webapp的部署目录,如下图：<BR><IMG height=70 alt=Snap1.jpg src="http://www.blogjava.net/images/blogjava_net/zqc/xxx/Snap1.jpg" width=116 border=0><BR>下载<A href="http://ant.apache.org/">ant</A>,解压缩,设置环境变量ant_home指向刚才解压缩的目录,<BR>来到项目目录/src下,新建一个文本文件,加入以下编译内容</P>
<DIV style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
<DIV><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">project&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="StrutsExample"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;default</SPAN><SPAN style="COLOR: #0000ff">="complie"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;basedir</SPAN><SPAN style="COLOR: #0000ff">="."</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">property&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="src"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;location</SPAN><SPAN style="COLOR: #0000ff">="."</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">property&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="dest"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;location</SPAN><SPAN style="COLOR: #0000ff">=".."</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000"><!--</SPAN><SPAN style="COLOR: #008000">classpath</SPAN><SPAN style="COLOR: #008000">--></SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">path&nbsp;</SPAN><SPAN style="COLOR: #ff0000">id</SPAN><SPAN style="COLOR: #0000ff">="compile.classpath"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">pathelement&nbsp;</SPAN><SPAN style="COLOR: #ff0000">path&nbsp;</SPAN><SPAN style="COLOR: #0000ff">="${dest}/WEB-INF/lib/commons-beanutils.jar"</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">pathelement&nbsp;</SPAN><SPAN style="COLOR: #ff0000">path&nbsp;</SPAN><SPAN style="COLOR: #0000ff">="${dest}/WEB-INF/lib/commons-digester.jar"</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">pathelement&nbsp;</SPAN><SPAN style="COLOR: #ff0000">path&nbsp;</SPAN><SPAN style="COLOR: #0000ff">="D:/jakarta-tomcat-4.1.30/common/lib/servlet.jar"</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">pathelement&nbsp;</SPAN><SPAN style="COLOR: #ff0000">path&nbsp;</SPAN><SPAN style="COLOR: #0000ff">="${dest}/WEB-INF/lib/struts.jar"</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">pathelement&nbsp;</SPAN><SPAN style="COLOR: #ff0000">path&nbsp;</SPAN><SPAN style="COLOR: #0000ff">="${dest}/WEB-INF/lib/sovo-db.jar"</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">pathelement&nbsp;</SPAN><SPAN style="COLOR: #ff0000">path&nbsp;</SPAN><SPAN style="COLOR: #0000ff">="classes"</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff"></< SPAN><SPAN style="COLOR: #800000">path</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><BR></SPAN><SPAN style="COLOR: #008000"><!--</SPAN><SPAN style="COLOR: #008000">setup directory</SPAN><SPAN style="COLOR: #008000">--></SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">target&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="init"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">mkdir&nbsp;</SPAN><SPAN style="COLOR: #ff0000">dir</SPAN><SPAN style="COLOR: #0000ff">="${dest}/WEB-INF/classes"</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">mkdir&nbsp;</SPAN><SPAN style="COLOR: #ff0000">dir</SPAN><SPAN style="COLOR: #0000ff">="${dest}/WEB-INF/lib"</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff"></< SPAN><SPAN style="COLOR: #800000">target</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;<BR></SPAN><SPAN style="COLOR: #008000"><!--</SPAN><SPAN style="COLOR: #008000">complie</SPAN><SPAN style="COLOR: #008000">--></SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">target&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="complie"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;depends</SPAN><SPAN style="COLOR: #0000ff">="init"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">javac&nbsp;</SPAN><SPAN style="COLOR: #ff0000">srcdir</SPAN><SPAN style="COLOR: #0000ff">="${src}"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;destdir</SPAN><SPAN style="COLOR: #0000ff">="${dest}/WEB-INF/classes"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">classpath&nbsp;</SPAN><SPAN style="COLOR: #ff0000">refid</SPAN><SPAN style="COLOR: #0000ff">="compile.classpath"</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN style="COLOR: #000000"><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff"></< SPAN><SPAN style="COLOR: #800000">javac</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff"></< SPAN><SPAN style="COLOR: #800000">target</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><BR></SPAN><SPAN style="COLOR: #0000ff"></< SPAN><SPAN style="COLOR: #800000">project</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN></DIV></DIV>
<P><BR>具体就不解释了，不明白的就查资料看看~<BR>把文件改名为build.xml</P>
<P>在同一目录下,建立一个make.bat文件,用记事本打开，加入<BR>%ant_home%/bin/ant</P>
<P>以上编译的准备工作已经完成，下面就把它们集成到editplus中去:</P>
<P>1、添加新的外部命令行执行程序<BR>打开editplus(废话),点<BR>'Tools' -&gt; 'Configure User Tools'... -&gt;Add Tool(按钮)-&gt;Program<BR>填下面的参数:</P>
<P>Menu text:随便什么，比如 "编译整个工程"<BR>Command:点后面的'...'按钮，选择刚才的make.bat<BR>Argument:参数,留空就行<BR>Initial directory:起始目录，一般是当前目录。点后面的按钮,选'file directory'就行。</P>
<P>下面把Capture output 打上勾，以捕捉ant编译过程的输出.<BR>点旁边的'Output Pattern',去掉'Use default output pattern'的勾,点下面的下三角按钮,选"java/gcc"<BR>这样就能在输出报错时，双击有行号提示的地方，页面就会直接跳转到出错行。</P>
<P>按下面的带绿勾的OK按钮就完成了，刚才配置的工具就出现在Tools菜单的最底部了。</P>
<P>现在用editplus在src目录下随便建个源文件，然后运行刚才设置的工具,OK，大功告成!<BR>no more jb,no more Eclipse,no more netbeans,no more idea,hahaha......</P>
<P>另：把Tools - &gt; Preference - &gt; General&nbsp; -&gt; Reload working file on startup 打上勾，可以省去很多打开关闭文件的时间。<BR><BR>就这样了，祝大家用得开心，，还有，editplus只有30d的共享版哦，嘿嘿。。。</P></SPAN></SPAN></SPAN></SPAN></SPAN><img src ="http://www.blogjava.net/zqc/aggbug/12945.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zqc/" target="_blank">鸟不生蛋蛋的地方</a> 2005-09-13 23:25 <a href="http://www.blogjava.net/zqc/archive/2005/09/13/EditplusAndAnt.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>类似qq的汉字拼音首字查询</title><link>http://www.blogjava.net/zqc/archive/2005/08/08/hanzi.html</link><dc:creator>鸟不生蛋蛋的地方</dc:creator><author>鸟不生蛋蛋的地方</author><pubDate>Sun, 07 Aug 2005 16:59:00 GMT</pubDate><guid>http://www.blogjava.net/zqc/archive/2005/08/08/hanzi.html</guid><wfw:comment>http://www.blogjava.net/zqc/comments/9536.html</wfw:comment><comments>http://www.blogjava.net/zqc/archive/2005/08/08/hanzi.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/zqc/comments/commentRss/9536.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zqc/services/trackbacks/9536.html</trackback:ping><description><![CDATA[项目里要用到这个功能，自己边琢磨边找资料，弄出一个demo，大概思路是这样：用Properties的load()来加载一个固<A href="http://www.blogjava.net/Files/zqc/pyutf.zip">定格式的文本文件</A><SUP><A href="#ps1">注1</A></SUP>，然后直接当Hashtable用。<BR>
<DIV style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
<DIV><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">package&nbsp;org.navyblue.tests;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>import&nbsp;java.util.</SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG id=Codehighlighter1_50_104_Open_Image onclick="this.style.display='none'; Codehighlighter1_50_104_Open_Text.style.display='none'; Codehighlighter1_50_104_Closed_Image.style.display='inline'; Codehighlighter1_50_104_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_50_104_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_50_104_Closed_Text.style.display='none'; Codehighlighter1_50_104_Open_Image.style.display='inline'; Codehighlighter1_50_104_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN id=Codehighlighter1_50_104_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</SPAN><SPAN id=Codehighlighter1_50_104_Open_Text><SPAN style="COLOR: #008000">/*</SPAN><SPAN style="COLOR: #008000">*<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;*<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;*&nbsp;类似qq的汉字拼音首字查询方法<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;*&nbsp;by&nbsp;zqc&nbsp;2005-08-04<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;*<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>&nbsp;**</SPAN><SPAN style="COLOR: #008000">*/</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">class</SPAN><SPAN style="COLOR: #000000">&nbsp;pyTest<BR><IMG id=Codehighlighter1_126_1067_Open_Image onclick="this.style.display='none'; Codehighlighter1_126_1067_Open_Text.style.display='none'; Codehighlighter1_126_1067_Closed_Image.style.display='inline'; Codehighlighter1_126_1067_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_126_1067_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_126_1067_Closed_Text.style.display='none'; Codehighlighter1_126_1067_Open_Image.style.display='inline'; Codehighlighter1_126_1067_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top></SPAN><SPAN id=Codehighlighter1_126_1067_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_126_1067_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG id=Codehighlighter1_144_145_Open_Image onclick="this.style.display='none'; Codehighlighter1_144_145_Open_Text.style.display='none'; Codehighlighter1_144_145_Closed_Image.style.display='inline'; Codehighlighter1_144_145_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_144_145_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_144_145_Closed_Text.style.display='none'; Codehighlighter1_144_145_Open_Image.style.display='inline'; Codehighlighter1_144_145_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;pyTest()</SPAN><SPAN id=Codehighlighter1_144_145_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_144_145_Open_Text><SPAN style="COLOR: #000000">{}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;<BR><IMG id=Codehighlighter1_204_1065_Open_Image onclick="this.style.display='none'; Codehighlighter1_204_1065_Open_Text.style.display='none'; Codehighlighter1_204_1065_Closed_Image.style.display='inline'; Codehighlighter1_204_1065_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_204_1065_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_204_1065_Closed_Text.style.display='none'; Codehighlighter1_204_1065_Open_Image.style.display='inline'; Codehighlighter1_204_1065_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">public</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">static</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">void</SPAN><SPAN style="COLOR: #000000">&nbsp;main(String[]&nbsp;args)throws&nbsp;Exception</SPAN><SPAN id=Codehighlighter1_204_1065_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_204_1065_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Properties&nbsp;pyMap&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;Properties();<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">拼音隐射表</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pyMap.load(</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;java.io.FileInputStream(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">pyutf.txt</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">测试字符</SPAN><SPAN style="COLOR: #008000"><BR><IMG id=Codehighlighter1_341_372_Open_Image onclick="this.style.display='none'; Codehighlighter1_341_372_Open_Text.style.display='none'; Codehighlighter1_341_372_Closed_Image.style.display='inline'; Codehighlighter1_341_372_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_341_372_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_341_372_Closed_Text.style.display='none'; Codehighlighter1_341_372_Open_Image.style.display='inline'; Codehighlighter1_341_372_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String[]&nbsp;testStr&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN id=Codehighlighter1_341_372_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_341_372_Open_Text><SPAN style="COLOR: #000000">{</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">我们</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">阿哈</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">嘎嘎</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">干什么</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">郑晴川</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">谁</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">}</SPAN></SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">模拟输入</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;input&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">g</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.</SPAN><SPAN style="COLOR: #0000ff">out</SPAN><SPAN style="COLOR: #000000">.println&nbsp;(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">输入查询字符:g</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Vector&nbsp;inis&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;Vector();<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Vector&nbsp;results&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;Vector();<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Vector&nbsp;results2&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;Vector();<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">返回所有测试字符串的首字的打头拼音</SPAN><SPAN style="COLOR: #008000"><BR><IMG id=Codehighlighter1_640_825_Open_Image onclick="this.style.display='none'; Codehighlighter1_640_825_Open_Text.style.display='none'; Codehighlighter1_640_825_Closed_Image.style.display='inline'; Codehighlighter1_640_825_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_640_825_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_640_825_Closed_Text.style.display='none'; Codehighlighter1_640_825_Open_Image.style.display='inline'; Codehighlighter1_640_825_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">for</SPAN><SPAN style="COLOR: #000000">(&nbsp;</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">&nbsp;i&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">&nbsp;;&nbsp;i&nbsp;</SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">&nbsp;testStr.length&nbsp;;&nbsp;i</SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000">&nbsp;)</SPAN><SPAN id=Codehighlighter1_640_825_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_640_825_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG id=Codehighlighter1_686_708_Open_Image onclick="this.style.display='none'; Codehighlighter1_686_708_Open_Text.style.display='none'; Codehighlighter1_686_708_Closed_Image.style.display='inline'; Codehighlighter1_686_708_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_686_708_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_686_708_Closed_Text.style.display='none'; Codehighlighter1_686_708_Open_Image.style.display='inline'; Codehighlighter1_686_708_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;ini&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;String(&nbsp;</SPAN><SPAN style="COLOR: #0000ff">new</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">char</SPAN><SPAN style="COLOR: #000000">[]&nbsp;</SPAN><SPAN id=Codehighlighter1_686_708_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_686_708_Open_Text><SPAN style="COLOR: #000000">{&nbsp;testStr[i].charAt(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">)}</SPAN></SPAN><SPAN style="COLOR: #000000">&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;k&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;(String)pyMap.</SPAN><SPAN style="COLOR: #0000ff">get</SPAN><SPAN style="COLOR: #000000">(ini);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;results.add(k);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;results2.add(testStr[i]);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">输出结果</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top></SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">&nbsp;l&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;results.size();<BR><IMG id=Codehighlighter1_919_1062_Open_Image onclick="this.style.display='none'; Codehighlighter1_919_1062_Open_Text.style.display='none'; Codehighlighter1_919_1062_Closed_Image.style.display='inline'; Codehighlighter1_919_1062_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_919_1062_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_919_1062_Closed_Text.style.display='none'; Codehighlighter1_919_1062_Open_Image.style.display='inline'; Codehighlighter1_919_1062_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">for</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #0000ff">int</SPAN><SPAN style="COLOR: #000000">&nbsp;i&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">&nbsp;;&nbsp;i&nbsp;</SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">&nbsp;l&nbsp;;&nbsp;i</SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000">)</SPAN><SPAN id=Codehighlighter1_919_1062_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_919_1062_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;c&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;(String)results.</SPAN><SPAN style="COLOR: #0000ff">get</SPAN><SPAN style="COLOR: #000000">(i);<BR><IMG id=Codehighlighter1_993_1052_Open_Image onclick="this.style.display='none'; Codehighlighter1_993_1052_Open_Text.style.display='none'; Codehighlighter1_993_1052_Closed_Image.style.display='inline'; Codehighlighter1_993_1052_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_993_1052_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_993_1052_Closed_Text.style.display='none'; Codehighlighter1_993_1052_Open_Image.style.display='inline'; Codehighlighter1_993_1052_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">(c.equals(input))</SPAN><SPAN id=Codehighlighter1_993_1052_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_993_1052_Open_Text><SPAN style="COLOR: #000000">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.</SPAN><SPAN style="COLOR: #0000ff">out</SPAN><SPAN style="COLOR: #000000">.println&nbsp;(results2.</SPAN><SPAN style="COLOR: #0000ff">get</SPAN><SPAN style="COLOR: #000000">(i));<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</SPAN></SPAN></DIV></DIV><BR><BR><A name=ps1>----</A><BR>注1:这个映射文件系网上找来的，大约有14K的汉字量，一般也够用了~用文本工具对原先的格式做了些修改使它符合Properties的格式，然后再用native2ascii转成utf-8编码。<BR><BR><BR><BR>2005年8月8日 0:48:54<BR><img src ="http://www.blogjava.net/zqc/aggbug/9536.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zqc/" target="_blank">鸟不生蛋蛋的地方</a> 2005-08-08 00:59 <a href="http://www.blogjava.net/zqc/archive/2005/08/08/hanzi.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>