Have a look at the parse example in Serial Input Basics - simple reliable ways to receive data.
The parse example assumes you are using the 3rd style for receiving (with start- and end-markers) but it can easily be adapted for the second style with just an end-marker if that is more suitable for your scale.
It is not a good idea to use the String (capital S) class on an Arduino as it can cause memory corruption in the small memory on an Arduino. This can happen after the program has been running perfectly for some time. Just use cstrings - char arrays terminated with '\0' (NULL).
Robin2:
It is not a good idea to use the String (capital S) class on an Arduino as it can cause memory corruption in the small memory on an Arduino. This can happen after the program has been running perfectly for some time. Just use cstrings - char arrays terminated with '\0' (NULL).