I have a String which always looks like this:

---

```
data
data
data
data
non-data
non-data

```

---

And I need to delete the 2 last lines from it. The lenght of these lines can be different. How I can do that fast (String = ~1000 lines)?