小编nas*_*895的帖子

如何跳过Java字符串数组中的3个元素并获取下3个元素

我想获取由3个元素分隔的Array的字符串。例如,我需要跳过3个元素0,1,2,并取3,4,5个元素。重复一遍。(跳过6,7,8并获得9,10,11),直到数组结束。我该怎么办?

String s1[] = hh.split("\\r?\\n");
System.out.println(s1[3]);

for (int i=0;i<s1.length; i++){

}
Run Code Online (Sandbox Code Playgroud)

子串输出:


            org.springframework
            spring-jdbc
            1.0-m4

            org.apache.tomcat
            tomcat-jdbc
            7.0.19

            commons-configuration
            commons-configuration
            20030311.152757

            commons-io
            commons-io
            0.1

            org.springframework.security.oauth
            spring-security-oauth2
            2.1.1.RELEASE


Run Code Online (Sandbox Code Playgroud)

java loops

1
推荐指数
1
解决办法
524
查看次数

标签 统计

java ×1

loops ×1