StringUtils: Dropped an unneeded copy in lower-/upper-casing. (#3512)
This commit is contained in:
parent
7b8380c6df
commit
72e401313b
@ -304,8 +304,9 @@ AString & InPlaceUppercase(AString & s)
|
|||||||
|
|
||||||
AString StrToLower(const AString & s)
|
AString StrToLower(const AString & s)
|
||||||
{
|
{
|
||||||
AString res(s);
|
AString res;
|
||||||
std::transform(res.begin(), res.end(), res.begin(), ::tolower);
|
res.resize(s.size());
|
||||||
|
std::transform(s.begin(), s.end(), res.begin(), ::tolower);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,8 +316,9 @@ AString StrToLower(const AString & s)
|
|||||||
|
|
||||||
AString StrToUpper(const AString & s)
|
AString StrToUpper(const AString & s)
|
||||||
{
|
{
|
||||||
AString res(s);
|
AString res;
|
||||||
std::transform(res.begin(), res.end(), res.begin(), ::toupper);
|
res.resize(s.size());
|
||||||
|
std::transform(s.begin(), s.end(), res.begin(), ::toupper);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user