- Fix link resolution with proper relative/absolute path handling - Improve link styling with underline decoration - Hide leaf nodes from tree, only show directories - Fix log file path for packaged app
44 lines
1.0 KiB
Markdown
44 lines
1.0 KiB
Markdown
# operator== / operator!=
|
||
|
||
```cpp
|
||
inline bool operator==(const String& lhs, const String& rhs);
|
||
inline bool operator!=(const String& lhs, const String& rhs);
|
||
```
|
||
|
||
判断两个字符串是否相等或不相等。
|
||
|
||
**operator==:** 比较两个字符串的长度是否相等,以及内容是否相同。
|
||
|
||
**operator!=:** 相当于 `!(lhs == rhs)`。
|
||
|
||
**参数:**
|
||
- `lhs` - 左侧字符串
|
||
- `rhs` - 右侧字符串
|
||
|
||
**返回:** 布尔值,表示比较结果
|
||
|
||
**复杂度:** O(n),其中 n 为字符串长度
|
||
|
||
**示例:**
|
||
```cpp
|
||
#include "XCEngine/Containers/String.h"
|
||
#include <iostream>
|
||
|
||
int main() {
|
||
XCEngine::Containers::String s1("Hello");
|
||
XCEngine::Containers::String s2("Hello");
|
||
XCEngine::Containers::String s3("World");
|
||
|
||
std::cout << std::boolalpha;
|
||
std::cout << (s1 == s2) << std::endl; // 输出: true
|
||
std::cout << (s1 == s3) << std::endl; // 输出: false
|
||
std::cout << (s1 != s3) << std::endl; // 输出: true
|
||
|
||
return 0;
|
||
}
|
||
```
|
||
|
||
## 相关文档
|
||
|
||
- [String 总览](string.md) - 返回类总览
|