Java 字符串转化为数组


public static void main(String[] args) throws SQLException {
        String str1 = "阿迪达斯adidas neo VS JOG男女休闲鞋DB0466EH1696EH1698EH1699";
        String[] s = str1.split("");
        for(String each : s) {
            System.out.println(each);
        }
    }
public static void main(String[] args) throws SQLException {
        String str1 = "阿迪达斯adidas neo VS JOG男女休闲鞋DB0466EH1696EH1698EH1699";
         int length = str1.length();
         String[] arr2 = new String[length];
         for(int i=0; i<length; i++) {
             arr2[i] = str1.charAt(i) + "";
             System.out.println(arr2[i]);
         }
         System.out.println(arr2.length);     
    }

原址:https://www.cnblogs.com/qilin20/p/12354867.html


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM