Prefer TrimPrefix() over Left() + LeftChomp()

This commit is contained in:
J-P Nurmi
2015-08-14 12:29:42 +02:00
parent 2d5aa8da59
commit 475acd8f00
5 changed files with 7 additions and 16 deletions
+2 -4
View File
@@ -695,9 +695,8 @@ bool CTemplate::ValidExpr(const CString& sExpression) {
CString sName;
CString sValue;
if (sExpr.Left(1) == "!") {
if (sExpr.TrimPrefix("!")) {
bNegate = true;
sExpr.LeftChomp();
}
if (sExpr.find("!=") != CString::npos) {
@@ -810,8 +809,7 @@ CString CTemplate::GetValue(const CString& sArgs, bool bFromIf) {
return sRet;
}
} else {
if (sName.Left(1) == "*") {
sName.LeftChomp(1);
if (sName.TrimPrefix("*")) {
MCString::iterator it = find(sName);
sName = (it != end()) ? it->second : "";
}