From 46e6bf17dbbb98781ee62f137cbe5bb3c93caca7 Mon Sep 17 00:00:00 2001 From: Dan Warner Date: Sun, 13 Nov 2022 13:14:27 +0000 Subject: [PATCH] update trim --- libsgp4/Util.cc | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/libsgp4/Util.cc b/libsgp4/Util.cc index af0019e..3437aab 100644 --- a/libsgp4/Util.cc +++ b/libsgp4/Util.cc @@ -23,26 +23,15 @@ namespace libsgp4::Util { - namespace - { - struct IsDigit: std::unary_function - { - bool operator()(char c) const - { - return std::isdigit(c, std::locale::classic()) == 0; - } - }; - } - void TrimLeft(std::string& s) { s.erase(s.begin(), - std::find_if(s.begin(), s.end(), std::not1(IsDigit()))); + std::find_if(s.begin(), s.end(), [](unsigned char c){ return std::isgraph(c) != 0; })); } void TrimRight(std::string& s) { - s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(IsDigit())).base(), + s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char c){ return std::isgraph(c) != 0; }).base(), s.end()); }