阅读背景:

统计字符串中汉字的个数,字符串中字符自然排序

来源:互联网 
public class Test11 {
	public static void main(String[] args) throws Exception {
		//统计汉字个数
		String ss = "1432去fad阿萨德撒sgi";
		byte[] b = ss.getBytes("GBK");
		if(b.length>ss.length()) {
			System.out.println("有汉字,个数为"+(b.length-ss.length()));
		}
		
		System.out.println("===================================");
		//字符串中字符排序
		char[] cc = ss.toCharArray();
		System.out.println("排序前字符串:"+ss);
		Arrays.sort(cc);
		ss = new String(cc);
		System.out.println("排序后字符串:"+ss);
	}

}public class Test11 {
	public static void main(



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: