Using Serial.available() to break while loop

I cannot find a way out of this. I thin there isn't a way out. I have code like this, and it read available after while, and sets a boolean to false if I got what i wanted, but still it keeps reading as long as data is ready. It's not the while being the problem, but read or readln in serial. I use myserial.readstring(); It keeps reading. I even turn of serial.
if (skal&&Panelet.available()){
int start=-1;
int Ende=-1;
uferdig=true;
String leses;
while (uferdig){ //Leser tilgjengelige data før visning
leses=Panelet.readString();
uferdig=Panelet.available();
if (start<0){
start=leses.indexOf("KD");
nummer=leses;//.substring(start);
} else nummer+=leses;
Ende=nummer.indexOf("#");
if(Ende>-1){
nummer=nummer.substring(start+5,Ende-2);
uferdig=false;
skal=false;
Panelet.end();
digitalWrite(statusLED,LOW);
}
//if(!skal)break;
}

Your code is very difficult to read because it is poorly formatted - please use the AutoFormat tool.

Also please always post a complete program. What you have posted is missing a closing } so I have no idea if it is a complete snippet.

In any case I can't understand your description of the problem. In general, if you need to break out of a WHILE then you should not be using a WHILE.

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).

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.

...R