ASP.net(c#)查找出一段文字中出现次数最多的字(2013-03-25 13:07:16)
编写思路
有一段文字,我们不知其中出现最多是哪个字,这就不同于给你一个字查找这个字在某段中出现的次数,但我们可以利用这个思路,先找出每个字出现的次数,再对比那个多。
实现代码
界面我们要一个输入框、一个输出框和一个按纽
<asp:TextBox ID="txtSegment" runat="server"
TextMode="MultiLine" Height="172px"
Width="280px"></asp:TextBox>
<asp:Button ID="btnFind" runat="server" style="
position:relative; top:-80px" Text="查找文段出现次数最多的字" Height="71px"
<asp:TextBox ID="txtResult" runat="server"
TextMode="MultiLine" Height="172px"
Width="280px"></asp:TextBox>
cs代码
protected void
btnFind_Click(object sender, EventArgs e)
以上是我自己写的一个程序 |
|