Split alphabet and number from Serial to LCD

Hello! I'm new to arduino and really appreciate any help for my project.

So, this is my question. How can i separate number and alphabet from serial monitor?

If i write information to serial, such as "Jekkyl and Hyde = 13" but i want to show the "Jekkyl and Hyde" in the first line of my LCD and 13 in the second line.

Thank you.

Have a look at the strtok() function. It allows you to split a string at a given character, such as '='

Have you successfully read the Serial input into a character array and terminated it with a zero to turn it into a string (lowercase s) ?

I haven’t succeed in changing serial to array yet :slightly_frowning_face: I found this code over the internet but i don’t know why it won’t work. I still try it to the serial monitor, though.

#include <string.h>
char *record;
char *p, *i;

void setup() {

  Serial.begin(9600);
  Serial.println("Starting..");
  while (Serial.available()){
  record = Serial.read();
  //Serial.print(input);
  
   //  First strtok iteration
   p = strtok_r(record,":",&i);
   Serial.print(p);
   Serial.print(" = ");

   //  Second strtok iteration
   p = strtok_r(NULL,":",&i);
   Serial.print(p);
   Serial.println("");
  }
}

void loop () {
}

The output only shows me Starting…

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example that illustrates the use of strtok()

…R

Thank you! After reading your tutorial, my code works like charm!