Skip to content

Commit e6698a0

Browse files
committed
修复错误
1 parent 97c0501 commit e6698a0

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

CodeService/src/LuaEditorConfig.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ std::shared_ptr<LuaCodeStyleOptions> LuaEditorConfig::Generate(std::string_view
9292
auto fileList = StringUtil::Split(fileListText, ",");
9393
for (auto fileMatchUri : fileList)
9494
{
95-
if (fileUri.ends_with(StringUtil::TrimSpace(fileMatchUri)))
95+
if (StringUtil::EndWith(fileUri,StringUtil::TrimSpace(fileMatchUri)))
9696
{
9797
patternKey.append("#").append(sectionPattern);
9898
luaSections.push_back(section);

Util/src/StringUtil.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ std::string StringUtil::Replace(std::string_view source, std::string_view oldStr
8989
return result;
9090
}
9191

92-
bool StringUtil::StartWith(const std::string& source, const std::string& str)
92+
bool StringUtil::StartWith(std::string_view source, std::string_view str)
9393
{
9494
if (source.size() < str.size())
9595
{
@@ -99,7 +99,7 @@ bool StringUtil::StartWith(const std::string& source, const std::string& str)
9999
return strncmp(source.data(), str.data(), str.size()) == 0;
100100
}
101101

102-
bool StringUtil::EndWith(const std::string& source, const std::string& str)
102+
bool StringUtil::EndWith(std::string_view source, std::string_view str)
103103
{
104104
if (source.size() < str.size())
105105
{

include/Util/StringUtil.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ namespace StringUtil
1313
std::string Replace(std::string_view source, std::string_view oldString, std::string_view newString);
1414

1515
// workaround for C++17
16-
bool StartWith(const std::string& source, const std::string& str);
16+
bool StartWith(std::string_view source, std::string_view str);
1717
// workaround for C++17
18-
bool EndWith(const std::string& source, const std::string& str);
18+
bool EndWith(std::string_view source, std::string_view str);
1919

2020
bool IsStringEqualIgnoreCase(std::string_view lhs, std::string_view rhs);
2121
}

0 commit comments

Comments
 (0)