今天遇到这样一个问题,统计字符串中字符的个数。
写了一个算法基本实现了这个功能,只是不知是否有性能更高的算法。
感兴趣的一起试试。方法比较简单,就不写注释了,相信大家能够看懂。
}
}
}
结果:
------10分钟后补充---------------------
索性再贴一个反转字符串的方法,以后想到别的字符串处理统统贴到这里。O(∩_∩)O哈哈~
{
sb.Append(c);
}
Console.WriteLine(sb.ToString());
}
结果:
------20090226补充---------------------
拆分这样的串:"1.aa|2.bb|3.cc=4.dd|5.ee|6.ff=7.dd|8.ee|9.ff"
}
结果:
( class1=1 and class2=2 and class3=3 ) or
( class1=4 and class2=5 and class3=6 ) or
( class1=7 and class2=8 and class3=9 )