# How to Search Char Variable for Characters

**URL:** <https://forum.arduino.cc/t/how-to-search-char-variable-for-characters/649660>\
**Category:** Programming\
**Created:** [April 18, 2020, 11:32pm UTC](https://forum.arduino.cc/t/how-to-search-char-variable-for-characters/649660 "2020-04-18T23:32:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZebH](https://avatars.discourse-cdn.com/v4/letter/z/e0b2c6/32.png) [@ZebH](https://forum.arduino.cc/u/ZebH)\
**Post date:** [April 18, 2020, 11:32pm UTC](https://forum.arduino.cc/t/how-to-search-char-variable-for-characters/649660/1 "2020-04-18T23:32:34Z")

</div>

Hi all,

I want to search a "Char Variable" for the characters "Status Code: 401".

I have looked on the internet but have not been able to find what I need so any help would be awesome!

Thanks,

Zeb

---

<div class="post-metadata">

**Author:** ![gfvalvo](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/gfvalvo/32/1013044_2.png) [@gfvalvo](https://forum.arduino.cc/u/gfvalvo)\
**Post date:** [April 18, 2020, 11:44pm UTC](https://forum.arduino.cc/t/how-to-search-char-variable-for-characters/649660/2 "2020-04-18T23:44:40Z")

</div>

> ZebH:  
> I have looked on the internet but have not been able to find what I need so any help

How about here: [http://www.cplusplus.com/reference/cstring/](http://www.cplusplus.com/reference/cstring/)

---

<div class="post-metadata">

**Author:** ![ZebH](https://avatars.discourse-cdn.com/v4/letter/z/e0b2c6/32.png) [@ZebH](https://forum.arduino.cc/u/ZebH)\
**Post date:** [April 18, 2020, 11:49pm UTC](https://forum.arduino.cc/t/how-to-search-char-variable-for-characters/649660/3 "2020-04-18T23:49:07Z")

</div>

Sweet as, thanks Faraday Member!

---

<div class="post-metadata">

**Author:** ![ZebH](https://avatars.discourse-cdn.com/v4/letter/z/e0b2c6/32.png) [@ZebH](https://forum.arduino.cc/u/ZebH)\
**Post date:** [April 19, 2020, 12:01am UTC](https://forum.arduino.cc/t/how-to-search-char-variable-for-characters/649660/4 "2020-04-19T00:01:55Z")

</div>

I still can't find anything that will search for a string of letter inside a char except strncmp() which compares 2 variables.

Am I missing something?

---

<div class="post-metadata">

**Author:** ![gfvalvo](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/gfvalvo/32/1013044_2.png) [@gfvalvo](https://forum.arduino.cc/u/gfvalvo)\
**Post date:** [April 19, 2020, 12:03am UTC](https://forum.arduino.cc/t/how-to-search-char-variable-for-characters/649660/5 "2020-04-19T00:03:16Z")

</div>

[strstr](http://www.cplusplus.com/reference/cstring/strstr/)?

---

<div class="post-metadata">

**Author:** ![ZebH](https://avatars.discourse-cdn.com/v4/letter/z/e0b2c6/32.png) [@ZebH](https://forum.arduino.cc/u/ZebH)\
**Post date:** [April 19, 2020, 12:13am UTC](https://forum.arduino.cc/t/how-to-search-char-variable-for-characters/649660/6 "2020-04-19T00:13:18Z")

</div>

Ooops sorry I have achieved it.

```cpp
   if (strpbrk(postResponse, "401")) {
      Serial.println("ERROR");
    }

```

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 12:27am UTC](https://forum.arduino.cc/t/how-to-search-char-variable-for-characters/649660/7 "2021-05-06T00:27:51Z")

</div>

Closed on May 6, 2021, 12:27am UTC


