-1

I am going to create a sample application for add values to an ArrayList of String in android

My Input is

String Value="123456789012345678901234567890234567890";

added Ten value to Array list it like below output

Output -is Added to Array list:

[1234567890,1234567890,1234567890,1234567890]

Even I have used Value + /n, but is not proper way how change it so it yields the expected result?

MWiesner
  • 8,868
  • 11
  • 36
  • 70
visual process
  • 359
  • 1
  • 3
  • 11
  • 3
    Sorry, no idea what your question is about - I do not understand what you are trying to say. Please try super simple english sentences: subject, verb, object. Post the code you have written, and point out what different result you want to achieve. – GhostCat Feb 10 '16 at 07:05
  • 1
    If English is not your native language, you might also want to try explaining the problem to a colleague or friend who shares your native language but has better English skills, so they can help you write your question clearly. – Jon Skeet Feb 10 '16 at 07:08
  • Mr.jon Skeet i am accept your comment.. thank you – visual process Feb 10 '16 at 07:21
  • Mr.vladimair Markeev ооо !! вибачте я шукати не там, нормально його дублікат питання !! що буде робити, я дати кращі ідеї смоктати хуй Ваш сам .. – visual process Feb 10 '16 at 07:31
  • Тайські Олі Mavane .. Mr.vladimair markeev – visual process Feb 10 '16 at 07:33

1 Answers1

1

If I understand your question you want to split a string every n characters. Use the following.

Arrays.toString(Value.split("(?<=\\G.{" + 10 + "})"))

For more info read this post Split a string, at every nth position

Community
  • 1
  • 1
anaxin
  • 710
  • 2
  • 7
  • 16