updated LTRIM and RTRIM to work with C++14 and up

This commit is contained in:
Armando Rivera 2022-11-24 23:57:57 -05:00
parent 53c8b24625
commit 824cd1747c

View File

@ -83,13 +83,15 @@ SUB PRINT (CSTRING A="") BEGIN
ENDSUB
FUNCTION CSTRING LTRIM$ (CSTRING s) BEGIN
s.erase(s.begin(),std::find_if(s.begin(),s.end(),std::not1(std::ptr_fun<INT,INT>(std::isspace))));
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](char c) { return !std::isspace<char>(c, std::locale::classic());}));
RETURN s;
ENDFUNCTION
FUNCTION CSTRING RTRIM$ (CSTRING s) BEGIN
s.erase(std::find_if(s.rbegin(),s.rend(),std::not1(std::ptr_fun<INT,INT>(std::isspace))).base(),s.end());
auto it = std::find_if(s.rbegin(), s.rend(), [](char c) { return !std::isspace<char>(c, std::locale::classic());});
s.erase(it.base(), s.end());
RETURN s;
ENDFUNCTION