zoukankan      html  css  js  c++  java
  • 将输入的字符串按指定的长度进行拆分

    public static String[] splitString(String str,int splitLength){

      char[] cs=str.toCharArray();

      int resultArrayLength=cs.length/splitLength;

      if(cs.length%splitLength!=0){

        resultArrayLength++;

      }

      String[] resultArray=new String[resultArrayLength];

     

      for (int j = 0; j <resultArray.length; j++) {

        if(j==resultArray.length-1){

          splitLength=cs.length-splitLength*j;

        }

        resultArray[j]=new String(cs,splitLength*j,splitLength);

      }

      return resultArray;

    }

  • 相关阅读:
    ubuntu使用iso作为本地源
    ubuntu配置简单的DNS服务器
    core data
    Core Animation教程
    制作framework&静态库
    notes
    textkit
    coretext
    nsset
    iOS Development Sites
  • 原文地址:https://www.cnblogs.com/yshyee/p/3352160.html
Copyright © 2011-2022 走看看