output
find: def defghijklmnopqrst
find: 248 not found
find: 6abc 6abcdefghijklmnopqrst
char *
find (
const char *haystack,
const char *needle )
{
char *s = strstr (haystack, needle);
Serial.print ("find: ");
Serial.print (needle);
Serial.print (" ");
if (s)
Serial.println (s);
else {
Serial.println ("not found");
}
return s;
}
// -----------------------------------------------------------------------------
void setup ()
{
Serial.begin (19200);
const char *haystack = "123456abcdefghijklmnopqrst";
find (haystack, "def");
find (haystack, "248");
find (haystack, "6abc");
}
// -----------------------------------------------------------------------------
void loop ()
{
}