修复了EString的一些bug
This commit is contained in:
parent
ef85e2b88d
commit
b40ca90a70
|
|
@ -16,17 +16,9 @@ int WINAPI WinMain(
|
||||||
str += L"4";
|
str += L"4";
|
||||||
UINT h1 = str.hash();
|
UINT h1 = str.hash();
|
||||||
|
|
||||||
EString s = L"abcdea";
|
EString string;
|
||||||
EString ss = s.sub(0);
|
string = string + L"Hello" + 2017 + L"!";
|
||||||
EString sss = s.sub(0, 5);
|
string.append(L"Hello").append(2017).append(L"!");
|
||||||
EString ssss = s.sub(0, 9);
|
|
||||||
EString ssssss = s.sub(1, 4);
|
|
||||||
EString sssss = s.sub(-1, 3);
|
|
||||||
int i = s.findFirstOf(L'a');
|
|
||||||
int j = s.findLastOf(L'a');
|
|
||||||
|
|
||||||
EString string = L"Hello";
|
|
||||||
string = string + 2017 + L"!";
|
|
||||||
|
|
||||||
EString str2;
|
EString str2;
|
||||||
str2 += 1;
|
str2 += 1;
|
||||||
|
|
|
||||||
|
|
@ -314,7 +314,7 @@ EString e2d::EString::sub(int offset, int count) const
|
||||||
return std::move(str_temp);
|
return std::move(str_temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
int e2d::EString::findFirstOf(wchar_t ch) const
|
int e2d::EString::findFirstOf(const wchar_t ch) const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _size; i++)
|
for (int i = 0; i < _size; i++)
|
||||||
if (_string[i] == ch)
|
if (_string[i] == ch)
|
||||||
|
|
@ -323,7 +323,7 @@ int e2d::EString::findFirstOf(wchar_t ch) const
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int e2d::EString::findLastOf(wchar_t ch) const
|
int e2d::EString::findLastOf(const wchar_t ch) const
|
||||||
{
|
{
|
||||||
int index = -1;
|
int index = -1;
|
||||||
|
|
||||||
|
|
@ -334,17 +334,17 @@ int e2d::EString::findLastOf(wchar_t ch) const
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
EString & e2d::EString::append(wchar_t ch)
|
EString & e2d::EString::append(const wchar_t ch)
|
||||||
{
|
{
|
||||||
return (*this) += ch;
|
return (*this) += ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
EString & e2d::EString::append(wchar_t * str)
|
EString & e2d::EString::append(const wchar_t * str)
|
||||||
{
|
{
|
||||||
return (*this) += str;
|
return (*this) += str;
|
||||||
}
|
}
|
||||||
|
|
||||||
EString & e2d::EString::append(EString & str)
|
EString & e2d::EString::append(const EString & str)
|
||||||
{
|
{
|
||||||
return (*this) += str;
|
return (*this) += str;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ public:
|
||||||
EString operator+(const std::wstring &);
|
EString operator+(const std::wstring &);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
EString &operator+(const T value)
|
EString operator+(const T value)
|
||||||
{
|
{
|
||||||
EString str_temp(*this);
|
EString str_temp(*this);
|
||||||
|
|
||||||
|
|
@ -203,23 +203,23 @@ public:
|
||||||
EString sub(int offset, int count = -1) const;
|
EString sub(int offset, int count = -1) const;
|
||||||
|
|
||||||
// 获取字符串中第一个特定字符的下标
|
// 获取字符串中第一个特定字符的下标
|
||||||
int findFirstOf(wchar_t ch) const;
|
int findFirstOf(const wchar_t ch) const;
|
||||||
|
|
||||||
// 获取字符串中最后一个特定字符的下标
|
// 获取字符串中最后一个特定字符的下标
|
||||||
int findLastOf(wchar_t ch) const;
|
int findLastOf(const wchar_t ch) const;
|
||||||
|
|
||||||
// 后接字符
|
// 后接字符
|
||||||
EString &append(wchar_t ch);
|
EString &append(const wchar_t ch);
|
||||||
|
|
||||||
// 后接字符串
|
// 后接字符串
|
||||||
EString &append(wchar_t *str);
|
EString &append(const wchar_t *str);
|
||||||
|
|
||||||
// 后接字符串
|
// 后接字符串
|
||||||
EString &append(EString &str);
|
EString &append(const EString &str);
|
||||||
|
|
||||||
// 后接字符串
|
// 后接字符串
|
||||||
template<typename T>
|
template<typename T>
|
||||||
EString &append(T &value)
|
EString &append(const T &value)
|
||||||
{
|
{
|
||||||
return (*this) += value;
|
return (*this) += value;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue