|
3 | 3 | #include "LuaParser/LuaTokenTypeDetail.h" |
4 | 4 | #include "Util/format.h" |
5 | 5 | #include "CodeService/LanguageTranslator.h" |
6 | | - |
| 6 | +#include "Util/StringUtil.h" |
7 | 7 |
|
8 | 8 | NameStyleRuleMatcher::NameStyleRule::NameStyleRule(NameStyleType type) |
9 | 9 | : Type(type) |
@@ -433,7 +433,8 @@ bool NameStyleRuleMatcher::Same(DiagnosisContext& ctx, std::shared_ptr<CheckElem |
433 | 433 | return SameSimple(filename, checkElement); |
434 | 434 | } |
435 | 435 | } |
436 | | - else if (firstParam.size() > 2 && (firstParam.starts_with("\'") || firstParam.starts_with("\""))) |
| 436 | + else if (firstParam.size() > 2 && (StringUtil::StartWith(firstParam, "\'") || StringUtil::StartWith( |
| 437 | + firstParam, "\""))) |
437 | 438 | { |
438 | 439 | auto name = firstParam.substr(1, firstParam.size() - 2); |
439 | 440 | return checkElement->Node->GetText() == name; |
@@ -488,7 +489,7 @@ bool NameStyleRuleMatcher::SameCamel(std::string_view text, std::shared_ptr<Chec |
488 | 489 |
|
489 | 490 | for (auto it = textParts.rbegin(); it != textParts.rend(); ++it) |
490 | 491 | { |
491 | | - if (checkText.ends_with(*it)) |
| 492 | + if (StringUtil::EndWith(checkText, *it)) |
492 | 493 | { |
493 | 494 | if (checkText.size() == it->size()) |
494 | 495 | { |
@@ -518,7 +519,7 @@ bool NameStyleRuleMatcher::SamePascal(std::string_view text, std::shared_ptr<Che |
518 | 519 |
|
519 | 520 | for (auto it = textParts.rbegin(); it != textParts.rend(); --it) |
520 | 521 | { |
521 | | - if (checkText.ends_with(*it)) |
| 522 | + if (StringUtil::EndWith(checkText, *it)) |
522 | 523 | { |
523 | 524 | if (checkText.size() == it->size()) |
524 | 525 | { |
|
0 commit comments