第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

文本分析程序,漢字計數(shù)為什么不對啊- -

文本分析程序,漢字計數(shù)為什么不對啊- -

killio 2017-06-12 22:24:51
package java_homework;import java.io.BufferedReader;import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.FileReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.Arrays;import java.util.regex.Matcher;import java.util.regex.Pattern;public class testBeta { public static void main(String[] args) throws IOException { File fleInput=new File("D:\\zed.txt"); ? ? ? ?FileInputStream fis=new FileInputStream(fleInput); ? ? ? ?InputStreamReader fsr=new InputStreamReader(fis); ? ? ? ?BufferedReader br=new BufferedReader(fsr); ? ? ? ?? ? ? ? ?int intAlpha,intNum,intOther,intChinese; ? ? ? ?? ? ? ? ?intAlpha=intNum=intOther=intChinese=0; ? ? ? ?int intChar=br.read(); ? ? ? ?while (intChar!=-1){ ? ? ? ? ? ?if ((intChar>=0x41 && intChar<=0x5A) || (intChar>=0x61&& intChar<=0x7A)){ ? ? ? ? ? ? ? ?intAlpha++; ? ? ? ? ? ?}else if (intChar>=0x30 && intChar<=0x39){ ? ? ? ? ? ? ? ?intNum++; ? ? ? ? ? ?}else if (intChar>=0 && intChar<=127) ? ? ? ? ? ?{ ? ? ? ? ? ? ? ?intOther++; ? ? ? ? ? ?}else{ ? ? ? ? ? ? ? ?intChinese++; ? ? ? ? ? ?} ? ? ? ? ? ?intChar=br.read(); ? ? ? ?} ? ? ? ?? ? ? ? ?fis.close(); ? ? ? ?? ? ? ? ?System.out.println("Alpha count=" + intAlpha); ? ? ? ?System.out.println("Number count=" + intNum); ? ? ? ?System.out.println("Other count=" + intOther); ? ? ? ?System.out.println("Chinese count=" + intChinese); } }
查看完整描述

1 回答

?
呦呦米

TA貢獻90條經(jīng)驗 獲得超59個贊

編碼方式不同貌似占位的數(shù)量不一樣

查看完整回答
反對 回復 2017-06-13
  • killio
    killio
    但是他一個漢子輸出3個,兩個漢字輸出5個- -就算是輸出字節(jié)數(shù)我也不知道哪個編碼是這樣的。。UTF-16be也應該是兩個漢字輸出6個啊
  • 1 回答
  • 0 關注
  • 1244 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號