| String

| Reference for Wiring 1.0 (ALPHA) 0022+. 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 |  | ### compareTo()
Examples |  |
    String str = String("CCCP");
    String str1 = String("CCCP");
    int p1 = str.compareTo(str1);
    Serial.println(p1, DEC); // Prints 0
Description |  | Compares two strings lexicographically based on the value of each character in the strings. The character sequence represented by this String object is compared lexicographically to the character sequence represented by the argument string. The result is a negative integer if this String object lexicographically precedes the argument string. The result is a positive integer if this String object lexicographically follows the argument string. The result is zero if the strings are equal.
Syntax |  |
    compareTo(str)
Parameters |  |
str |  | String: the substring to compare with
Returns |  | int
Usage |  | Web & Application