Question: So Im trying to split into different lines so it first line is:

```
Aaron123,Nesmith456,Bruno789,Cabo12,Jay21,Smith22 //-- 1st line

Aaron12,Nesmith22,Bruno33,Cabo44,Jay55,Smith66 //-- 2nd line

```

The code I am currently using is:

```
  String s1 =  ("Aaron123,Nesmith456,Bruno789,Cabo12,Jay21,Smith22,Aaron12,Nesmith22,Bruno33,Cabo44,Jay55,Smith66);
   String s[];
    s = s1.split("Aaron");
    System.out.print(s[0]);

```

After doing that code it splits the line but the aaron part of both lines are missing and actually splits into 3 line instead of 2 lines where first line is just empty for some reason so I need help fixing this

Wrong output I get:

```
123,Nesmith456,Bruno789,Cabo12,Jay21,Smith22

12,Nesmith22,Bruno33,Cabo44,Jay55,Smith66

```

The output I want:

```
Aaron123,Nesmith456,Bruno789,Cabo12,Jay21,Smith22 //-- 1st line

Aaron12,Nesmith22,Bruno33,Cabo44,Jay55,Smith66 //-- 2nd line

```

Answer: 
* Use Javascript built-in array function `slice()`
* For Ex:

```
let fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango", "Banana", "Orange", "Lemon", "Apple", "Mango"];
fruits.slice(0, 3);     // 0 => offset, 3 => limit

```
* output

```
output => [Banana,Orange,Lemon]

```
If you can not change the backend/API to use pagination - you can use the following function to split the Array with results from the API into smaller chunks:

```js
function arrChunk(arr, size)
{
  return arr.reduce((acc, e, i) =>
  {
    if (i % size)
    {
      acc[acc.length - 1].push(e);
    }
    else
    {
      acc.push([e]);
    }
    return acc;
  }, []);
}

```

**But the best option is to change the backend and avoid transferring excessive data over the network.**