亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Java outputs each character in a string containing commas
PHP中文網(wǎng)
PHP中文網(wǎng) 2017-06-28 09:24:45
0
3
1119
    public void evaluateCourse() {
//        Res res = new Res();
//        Connection con = null;
        String total = "1,2,33,53";
        for(int i = 0;i < total.length() ; i ++){
            if(total.charAt(i) != ','){
                System.out.println(total.charAt(i));
            }
        }
    }

The output result is

The result I want is: 1

            2
            33
            53
PHP中文網(wǎng)
PHP中文網(wǎng)

認(rèn)證高級(jí)PHP講師

reply all(3)
伊謝爾倫

Don’t use it yetString.split()

    public void evaluateCourse() {
//        Res res = new Res();
//        Connection con = null;
        String total = "1,2,33,53";
        String temp = "";
        for(int i = 0;i < total.length() ; i ++){
            temp += total.charAt(i);
            if(total.charAt(i) == ','){
                System.out.println(temp);
                temp = "";
            }
        }
    }

Look at using split again

public void evaluateCourse() {
//        Res res = new Res();
//        Connection con = null;
        String total = "1,2,33,53";
        String[] temp = aa.split(",");
        for(String s : temp) {
            System.out.println(s);
        }
    }
phpcn_u1582

Why not use String.split()?

淡淡煙草味

Stream.of(total.split(",")).forEach(System.out::println);

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template