Is there a easier way of parsing a string?

I just want to use this code, but I dont want it to read in Serial monitor

Long story short, my data is from a GSM module that sends a string

i.e.

rc = "<1,9123,118.123,90>";
Just something i can call locally

Sorry I'm desperate

Below code is from - Serial Input Basics - updated - Introductory Tutorials - Arduino Forum

// Example 5 - Receive with start- and end-markers combined with parsing

const byte numChars = 32;
char receivedChars[numChars];
char tempChars[numChars];        // temporary array for use when parsing

      // variables to hold the parsed data
char messageFromPC[numChars] = {0};

char longitude[numChars] = {0};
char latitude[numChars] = {0};
char Speed[numChars] = {0};

int integerFromPC = 0;
float floatFromPC = 0.0;

boolean newData = false;

//============

void setup() 
{
  Serial.begin(9600);
  Serial.println("Enter data in this style <GSM,9.123,118.123,90>");
  Serial.println();
}

//============

void loop() 
{
  recvWithStartEndMarkers();
  if (newData == true) 
  {
  strcpy(tempChars, receivedChars);
  // this temporary copy is necessary to protect the original data
  //   because strtok() used in parseData() replaces the commas with \0
  parseData();
  showParsedData();
  newData = false;
  }
}

//============

void recvWithStartEndMarkers() 
{
  static boolean recvInProgress = false;
  static byte ndx = 0;
  char startMarker = '<';
  char endMarker = '>';
  char rc;

  while (Serial.available() > 0 && newData == false) 
  {
    rc = Serial.read();

    if (recvInProgress == true) 
      {
        if (rc != endMarker) 
          {
            receivedChars[ndx] = rc;
            ndx++;
            if (ndx >= numChars) 
            {
              ndx = numChars - 1;
            }
          }
        else 
          {
            receivedChars[ndx] = '\0'; // terminate the string
            recvInProgress = false;
            ndx = 0;
            newData = true;
          }
       }

      else if (rc == startMarker) 
        {
          recvInProgress = true;
        }
  }
}

//============

void parseData() 
{      // split the data into its parts

  char * strtokIndx; // this is used by strtok() as an index
  strtokIndx = strtok(tempChars,",");      // get the first part - the string
  strcpy(messageFromPC, strtokIndx); // copy it to messageFromPC
  strtokIndx = strtok(NULL,",");      // get the first part - the string
  strcpy(longitude, strtokIndx);           // copy it to messageFromPC
  strtokIndx = strtok(NULL,",");      // get the first part - the string
  strcpy(latitude, strtokIndx);            // copy it to messageFromPC
  strtokIndx = strtok(NULL,",");      // get the first part - the string
  strcpy(Speed, strtokIndx);               // copy it to messageFromPC
}

//============

void showParsedData() 
{
  Serial.print("Message     ");
  Serial.println(messageFromPC);
  Serial.print("Longitude     ");
  Serial.println(longitude);
  Serial.print("Latitude      ");
  Serial.println(latitude);
  Serial.print("Speed     ");
  Serial.println(Speed);
}

Maybe I don't understand what youwant to do but

  parseData();
 // showParsedData();
  newData = false;

will prevent printing to serial monitor.

I don't want to get my data from Serial.read();, I just wanted to get it locally from a char, String, etc . . ., Like

my data is from a GSM module that sends a string

I don't want to get my data from Serial.read();,

OK. Focus on the parseData() function

If you data is a null terminated character array, it just replaces the receivedChars[] array. You can use strtok to parse what you want from it.

cattledog:
OK. Focus on the parseData() function

Will do,