How split Word and Number received from Serial Minitor

Hi,

I'm send the command and value via serial monitor as this format "mystring NN.NN", how can I split these data into two variables?

Example:

Data send via Serial Monitor - Drink 25.00

Data received split to two variables MyItem = Drink MyMoney = 25.00

Thanks.

const char example[] =  "try 23.44";

void setup() {
  Serial.begin(250000);
  char buff[20] = "";
  int val1 = 0;
  int val2 = 0;
  byte count = sscanf(example, "%s %d.%d", buff, &val1, &val2);
  if (count == 3) {
    int iamount = val1 * 100 + val2;
    float famount = val1 + val2 / 100.0;
    Serial.print(F("succsessfully parsed '"));
    Serial.print(buff);
    Serial.print(F("' ints "));
    Serial.print(val1);
    Serial.print(F(" and "));
    Serial.print(val2);
    Serial.print(F(", as int "));
    Serial.print(iamount);
    Serial.print(F(", as float "));
    Serial.print(famount);
  }
}
void loop() {}

succsessfully parsed 'try' ints 23 and 44, as int 2344, as float 23.44

Have a look at the parse example in Serial Input Basics

...R