#includevoid setup() { WString str = L"Hello World!"; Serial.println(str); } void loop() { // do nothing }
#includevoid setup() { WString str1 = L"Hello"; WString str2 = L"World"; WString str3 = str1 + L" " + str2; Serial.println(str3); } void loop() { // do nothing }
#includeIn this example, we create a WString variable "str" and set its value to "Hello World!". We then use the length() function to get the length of the string and store the result in an integer variable "len". We finally print the value of "len" to the Serial Monitor. WString is a part of the Arduino framework/library.void setup() { WString str = L"Hello World!"; int len = str.length(); Serial.println(len); } void loop() { // do nothing }