From c548b437e6004328830f8b4f55ac922951ebdf3d Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 13 Feb 2014 12:51:15 +0000 Subject: Remove dependency on boost string algos --- src/lib/utils/parsing.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/lib/utils/parsing.cpp') diff --git a/src/lib/utils/parsing.cpp b/src/lib/utils/parsing.cpp index cf47e24f8..c5081dcd7 100644 --- a/src/lib/utils/parsing.cpp +++ b/src/lib/utils/parsing.cpp @@ -1,6 +1,6 @@ /* * Various string utils and parsing functions -* (C) 1999-2007,2013 Jack Lloyd +* (C) 1999-2007,2013,2014 Jack Lloyd * * Distributed under the terms of the Botan license */ @@ -105,18 +105,21 @@ std::vector parse_algorithm_name(const std::string& namex) return elems; } -/* -* Split the string on slashes -*/ std::vector split_on(const std::string& str, char delim) { + return split_on_pred(str, [delim](char c) { return c == delim; }); + } + +std::vector split_on_pred(const std::string& str, + std::function pred) + { std::vector elems; if(str == "") return elems; std::string substr; for(auto i = str.begin(); i != str.end(); ++i) { - if(*i == delim) + if(pred(*i)) { if(substr != "") elems.push_back(substr); -- cgit v1.2.3