String.equalsIgnoreCase() Arduino Function

Strings can store large data very easily. An Arduino string can take input from sensors and store them so it can be used for generating desired outputs. String in Arduino has a series of functions that allow users to handle data easily. One such function is String.equalsIgnoreCase(). This article covers this function’s syntax, parameters, and return in detail.

Table of Contents

Arduino String.equalsIgnoreCase() Function

The String.equalsIgnoreCase() function is used to compare two strings for equality while ignoring their case sensitivity.

This function returns true if the two strings have the same characters in the same sequence, regardless of the case of the letters.

For example, “LINUX” and “linux” would be considered equal when compared with this function.


The syntax of the String.equalsIgnoreCase() function is as follows:


Here, string1 and string2 are the two strings to be compared.


The String.equalsIgnoreCase() function takes only one parameter, which is the string to be compared with the original string.


This function returns either true or false.

True: If string1 matches with string2 (ignoring cases).

False: If string1 doesn’t match with string2.

How to Use String.equalsIgnoreCase() Function in Arduino

Now we will discuss an Arduino code that uses this function and compare two strings with different cases.

void setup() {


  String firstString = "linuxhint";

  String secondString = "LINUXHINT";

  if (firstString.equalsIgnoreCase(secondString))

Serial.println("The two strings are equal.");


Serial.println("The two strings are not equal.");


void loop() {


Here we have two string variables, firstString and, secondString, that contain the same characters but with different cases. We use the equalsIgnoreCase() function to compare them for equality, regardless of case sensitivity.

The program will output “The two strings are equal.” to the serial monitor because both strings are equal, only their case is different.

Shape Description automatically generated with medium confidence


The String.equalsIgnoreCase() function can compare two different strings by ignoring the case sensitivity. This article covers the syntax, parameter, and return value of this function. For details on String.equalsIgnoreCase() function, read the article.

About the author


I am an Electrical Engineer. I love to write about electronics. I am passionate about writing and sharing new ideas related to emerging technologies in the field of electronics.