equals()

描述

比较两个字串是否相等。比较过程中会区分大小写,所以字串 hello 和字串 HELLO 是不同的。

语法


string.equals(string2)

参数

string : String 物件 (字串)
string2 : 另一个 String 物件 (字串)

回传

true: 假如 string 字串与 string2 字串相同
false: 与上面相反

范例

StringComparisonOperators

See also

String
equalsIgnoreCase()
compareTo()


语法参考主页面

The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.