Question: I have got a string

```
$key1={331015EA261D38A7}
$key2={9145A98BA37617DE}
$key3={EF745F23AA67243D}

```

How do i split each of the keys based on "$" and the "next line" element? 
and then place it in an Arraylist?

The output should look like this:
Arraylist[0]:

```
$key1={331015EA261D38A7}

```

Arraylist[1]:

```
$key2={9145A98BA37617DE}

```

Arraylist[2]:

```
$key3={EF745F23AA67243D}

```

Answer: 
If you just want to split by new line, it is as simple as :

```
yourstring.split("\n"):

```
yourstring.split(System.getProperty("line.separator"));