Strings --- IndexOf Problem

Hi everyone!
I'm just trying to get specific characters from a string (from the internet, via ethernet shield), but I always get an "request for member IndexOf in answerstring, which is of non-class type char.
The characters I want to get are in between whitespaces and so I try to get the position of the whitespaces and the trim the lenght of the string. The code posted here is only about the position of the whitespaces.

This is the code:

char answerstring = client.read(); // gets the string from the client
int firstwhitespace = 3; // this is the position of the first white space
int secondwhitespace = answerstring.indexOf(' ', firstwhitespace); // this tries to get the 2nd whitespace, but doesn't work

Does anyone know what's wrong here? Thanks in advance

Does anyone know what's wrong here?

Yes, and if you used variable names that made sense, you would to.

char answerstring = client.read();

The client.read() function returns ONE character. You properly store that one character in a char variable, with a really dumb name. In spite of the name, the variable is neither a string or a String.

You can't use String functions on a char instance.

so, what would be a working solution?

so, what would be a working solution?

For what? For splitting one character at the comma? There is none.

For reading and parsing client data? The solution is to store all the data, at least until some recognizable separator, like a carriage return, comes along, and then parse it. Not using Strings, though. Learn how to do it with char arrays and string functions, like strtok().

Does anyone know what's wrong here? Thanks in advance

The test code below has a simple routine to capture the characters from the serial port into a string.

// zoomkat 7-30-11 serial I/O string test
// type a string in serial monitor. then send or enter
// for IDE 0019 and later

String readString;

void setup() {
  Serial.begin(9600);
  Serial.println("serial test 0021"); // so I can keep track of what is loaded
}

void loop() {

  while (Serial.available()) {
    delay(2);  //delay to allow byte to arrive in input buffer
    char c = Serial.read();
    readString += c;
  }

  if (readString.length() >0) {
    Serial.println(readString);

    readString="";
  } 
}