Arduino Strings / Char

Rule #1 - don't use the String class.  

	char myString[30];
	
	void setup() {
	  // update variable myString with new data
	  strcpy(myString, "New content#1");
	  strcpy(myString, "New content#2");
	  
	  // Concatenate data to myString
	  strcat(myString "Concat");
	  
	  // Assign "ABCDEF" to myString
	  strcpy(myString, "ABCDEF");
	  if (strcmp(myString, "ABCDEF") == 0 {
		// match found
	  }
	  
	}  // setup()
	
	void loop() {
	} // loop()

Helpful Links

https://hackingmajenkoblog.wordpress.com/2016/02/04/the-evils-of-arduino-strings/

 


Do you need help developing or customizing a IoT product for your needs?   Send me an email requesting a free one hour phone / web share consultation.  

 

The information presented on this website is for the author's use only.   Use of this information by anyone other than the author is offered as guidelines and non-professional advice only.   No liability is assumed by the author or this web site.