What is the fastest way to copy a portion of a string

So Im am recieving this data from a client. I have already got the important part and saved it into a string.

GET /favicon.ico HTTP/1.1

I would like to parse this string by white spaces, I am not sure if my method is most effecient.

String textToParse = "GET /favicon.ico HTTP/1.1"

char * duplicate = strdup(requestData.c_str());   //have to covert the string to a char* so that i can use strok
char * pch;
Serial.print("\nSplitting string to tokens:");

pch = strtok (duplicate," ");
Serial.println (pch);
pch = strtok (NULL, " ");
Serial.println (pch);
pch = strtok (NULL, " ");
Serial.println (pch);
Splitting string to tokens:GET /favicon.ico HTTP/1.1


Can this be further be optimized?

I do it this way because from what i have read HTTP request (GET,POST,DELETE, Etc.) do not have sapces in then and for the second part, URLs also cannot conatiain spaces in them. So i assume it is safe to use the 'space' character as an indicator to split

not sure what you want to do with the sub-strings.
consider the following

        int   N;
        char *t = s;
        char *toks [MAX_TOK];

        for (N = 0; NULL != (toks [N] = strtok (t, " ")); N++)  {
            t        = NULL;

Does it NEED to be further optimized? strtok() is pretty fast (much faster than Serial.println(), for example.)

one optimization I see is to use a char* for a reading buffer instead of the String.
at least this would spare the line to convert the String to a char* duplicate ...
but strtok() is ok.

I would like to save it into a variable (either a string or char* )for it to be compared later on

That is the thing i dont knnow if the code is already on the effecient side of the spectrum. if strok() is already on efficient side of things then im fine with it.

that's what the code i posted does