dream3323 2017-01-30 09:11
浏览 1208
已采纳

如何在Android Studio上将非常长的字符串拆分为多个字符串? [重复]

This question already has an answer here:

Hello i wanna split a very long string ( +10000 character) to multiple String.

I found there is a way with split() but i don't have space " " to split it.

I have only letter. Can i use a loop to split it?

For Example: it 's possible to split the string to multiple strings with 200 character for each one.

</div>
  • 写回答

1条回答 默认 最新

  • dongzhuifeng1843 2017-01-30 09:46
    关注

    As solved by this link, you can use Regex to achieve your requirement

    try

    System.out.println(Arrays.toString(
        "Thequickbrownfoxjumps".split("(?<=\\G.{4})")
    ));
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?