mystring.cpp
来自「WinCE5.0部分核心源码」· C++ 代码 · 共 63 行
CPP
63 行
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// This source code is licensed under Microsoft Shared Source License
// Version 1.0 for Windows CE.
// For a copy of the license visit http://go.microsoft.com/fwlink/?LinkId=3223.
//
#include "mystring.h"
#include <iostream>
#include <algorithm>
using namespace std;
bool operator==(const string &o1, const string &o2){
string s1 = o1;
string s2 = o2;
s1 = lowercase(s1);
s2 = lowercase(s2);
return s1.compare(s2) == 0;
}
bool operator==(const string &o1, const char *o2){
string s1 = o1;
string s2 = o2;
s1 = lowercase(s1);
s2 = lowercase(s2);
return s1.compare(s2) == 0;
}
bool operator==(const char *o1, const string &o2){
string s1 = o1;
string s2 = o2;
s1 = lowercase(s1);
s2 = lowercase(s2);
return s1.compare(s2) == 0;
}
bool operator!=(const string &o1, const string &o2){
return !(o1 == o2);
}
bool operator!=(const string &o1, const char *o2){
return !(o1 == o2);
}
bool operator!=(const char *o1, const string &o2){
return !(o1 == o2);
}
string lowercase(string s){
for(unsigned int i = 0; i < s.length(); i++)
s[i] = tolower(s[i]);
return s;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?