Substring of a char* in arduino

Following is a part of the code

void callback(char* topic, byte* payload, unsigned int length) {
  Serial.print("Message arrived [");
  Serial.print(topic);
  Serial.print("] ");

Now, I want to compare on a small part of the TOPIC in the function callback.

I tried

topic.substring(14,27) == "certain string"

But it gives an error. Obviously because I am trying to SUBSTRING a *CHAR type.

How can I do the comparison of only a small part of the string in this case with the least memory use?

I get an error too.

How can anyone do a comparison of only a small part of your code in this case with the least information?

strstr() maybe, but we really need more information.

OK.
when I print the topic with
Serial.print(topic)

The output I get is

abc/xyz/light/one

I just want to compare the

"/light/one" part

Do you just want to know if it is in there or also where it is?

For the first, use UKHeliBob's advise.

I just need to know if it is there.

once it is compared and is TRUE,

it will enter a loop and other functions will be performed

strstr()

Worked!!!

Thank You very much people!!

The return value from strtstr() will give you the position of the string in the target if you need it.

Shantanu24:
I tried

topic.substring(14,27) == "certain string"

But it gives an error. Obviously because I am trying to SUBSTRING a *CHAR type.

Perhaps try something like

if (strstr(topic,"certain string")==topic+13) ...

The strstr function is a standard function within standard-C libraries to find a (nullterminated) string within another (nullterminated) string. This function is also available within the Arduino IDE.