Java String Split splitString(String s)

Here you can find the source of splitString(String s)

Description

split String

License

Open Source License

Declaration

private static List<String> splitString(String s) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    private static List<String> splitString(String s) {
        if (s.length() < 256) {
            return Collections.singletonList(s);
        }/*  w  ww.ja  v a  2 s.  co  m*/

        List<String> list = new ArrayList<>();
        int lastPos = 0;
        for (int i = 0; i < s.length(); i++) {
            if (i % 255 == 0) {
                list.add(s.substring(lastPos, i));
                lastPos = i + 1;
            }
        }
        return list;
    }
}

Related

  1. splitSQLColumns(String sql)
  2. splitStep(String step)
  3. splitStr(String str, int toCount)
  4. splitString(String bigString, String splitter)
  5. splitString(String hexString, int partSize)
  6. splitString(String s)
  7. splitString(String s)
  8. splitString(String src, String target)
  9. splitString(String string)