1. 程式人生 > >java ascii轉String

java ascii轉String

line sta append spl stat stringbu char 解決 問題:

最近處理asciitoString時,發現晚上多沒有處理行,這裏解決處理行的問題:

    public static String asciiToString(String text) {
        StringBuilder sbu = new StringBuilder();
        String[] line =text.split("\n");
        for(String s:line){            
        String[] chars = s.split(" ");
            for (String char1 : chars) {
                sbu.append((
char) Integer.parseInt(char1)); } } return sbu.toString(); }

java ascii轉String