| 1 |
/* |
| 2 |
String Case changes |
| 3 |
|
| 4 |
Examples of how to change the case of a String |
| 5 |
|
| 6 |
created 27 Jul 2010 |
| 7 |
modified 2 Apr 2012 |
| 8 |
by Tom Igoe |
| 9 |
|
| 10 |
This example code is in the public domain. |
| 11 |
|
| 12 |
https://www.arduino.cc/en/Tutorial/BuiltInExamples/StringCaseChanges |
| 13 |
*/ |
| 14 |
|
| 15 |
void setup() { |
| 16 |
// Open serial communications and wait for port to open: |
| 17 |
Serial.begin(9600); |
| 18 |
while (!Serial) { |
| 19 |
; // wait for serial port to connect. Needed for native USB port only |
| 20 |
} |
| 21 |
|
| 22 |
// send an intro: |
| 23 |
Serial.println("\n\nString case changes:"); |
| 24 |
Serial.println(); |
| 25 |
} |
| 26 |
|
| 27 |
void loop() { |
| 28 |
// toUpperCase() changes all letters to upper case: |
| 29 |
String stringOne = "<html><head><body>"; |
| 30 |
Serial.println(stringOne); |
| 31 |
stringOne.toUpperCase(); |
| 32 |
Serial.println(stringOne); |
| 33 |
|
| 34 |
// toLowerCase() changes all letters to lower case: |
| 35 |
String stringTwo = "</BODY></HTML>"; |
| 36 |
Serial.println(stringTwo); |
| 37 |
stringTwo.toLowerCase(); |
| 38 |
Serial.println(stringTwo); |
| 39 |
|
| 40 |
|
| 41 |
// do nothing while true: |
| 42 |
while (true); |
| 43 |
} |