Removed for loops in place of .substr()

This commit is contained in:
sam-astro 2022-01-03 12:05:54 -05:00 committed by GitHub
parent 392879fbad
commit f796358af6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,8 +38,7 @@ string StringRaw(string str)
if (str[0] != '\"')
withoutQuotes += str[0];
for (int ch = 1; ch < (int)str.size() - 1; ch++)
withoutQuotes += str[ch];
withoutQuotes += str.substr(1, str.size()-2);
if (str[str.size() - 1] != '\"')
withoutQuotes += str[str.size() - 1];
@ -72,8 +71,7 @@ string RMParenthesis(string str)
if (str[0] != '(')
withoutParenthesis += str[0];
for (int ch = 1; ch < (int)str.size() - 1; ch++)
withoutParenthesis += str[ch];
withoutParenthesis += str.substr(1, str.size()-2);
if (str[str.size() - 1] != ')')
withoutParenthesis += str[str.size() - 1];