Convert string to lowercase or uppercase in Arduino

ArduinoArduino BoardsArduino IDEArduino Programming Language

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 −


void setup() {
   String s1 = "Hello World";
void loop() {
   // put your main code here, to run repeatedly:

The corresponding Serial Monitor output is −


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

Updated on 24-Mar-2021 05:24:09