void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
int num;
char out_str[40];
//Method 2 for manupulating strings function approach
char str[]="This is my string"; //created a string
//1. Print the string
Serial.println(str);
//2.Print the length of the string
num = strlen(str);//not include the null terminator
Serial.print("String lenght of str is = ");
Serial.println(num);
//3. Length of the ararry
num = sizeof(str);
Serial.print("Size of str string = ");
Serial.println(num);
//4. copy a string
strcpy(out_str, str);
Serial.println("use of strcpy function");
Serial.println(out_str);
//5.append a string
strcat(out_str, " sketch.");
Serial.println(out_str);
num=0;
num= strlen(out_str);
Serial.println(num);
num= sizeof(out_str);
Serial.println(num);
}
void loop() {
// put your main code here, to run repeatedly:
}
/*String in Arduino
1. Store text
2. Display text on LCD
3. Display text on serial monitor
4. Chracter input from keyboard
String is a combination of chracters----is an array of chracter*/