Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Convert string to lowercase or uppercase in Arduino
In order to convert a string to lower/upper case, the in-built .toLowerCase() and .toUpperCase() functions can be used.
Note: These functions change the original string itself, and don't return a new string with the changes.
The implementation is shown below −
Example
void setup() {
Serial.begin(9600);
Serial.println();
String s1 = "Hello World";
Serial.println(s1);
s1.toLowerCase();
Serial.println(s1);
s1.toUpperCase();
Serial.println(s1);
}
void loop() {
// put your main code here, to run repeatedly:
}
The corresponding Serial Monitor output is −
Output

As you can see, the changes have been made in s1 itself. The return of .toUpperCase() and .toLowerCase() is void.
Advertisements