| String

| Reference for Wiring 1.0 (ALPHA) 0021+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

Class |  | String
Name |  | ### equals()
Examples |  |
    String str1 = "CCCP";
    String str2 = "CCCP";
    // Tests to see if str1 is equal to str2
    if(str1.equals(str2) == true) {
      Serial.println("Equal");  // They are equal so this line will print
    } else {
      Serial.println("Not equal");
    }
    String str1 = "CCCP";
    char str3[] = "CCCP";
    // Tests to see if str1 is equal to str3

    void setup() {
      Serial.begin(9600);
      if(str1.equals(str3) == true) {
        Serial.println("Equal");  // They are equal so this line will print
      }
      else {
        Serial.println("Not equal");
      }

      if(str1.equals("CCCP") == true) {  // Testing directly
        Serial.println("Equal");  // They are equal so this line will print
      }
      else {
        Serial.println("Not equal");
      }
    }

    void loop() {
      // Nothing for loop()
    }
Description |  | Compares two strings to see if they are the same. This method is necessary because it's not possible to compare strings using the equality operator (==). Returns true if the strings are the same and false if they are not.
Syntax |  |
    equals(str)
Parameters |  |
str |  | String: any valid String
Returns |  | Boolean
Usage |  | Web & Application