From c91d8ac33cd1089ba1abf40350140277f31b4aa4 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Thu, 9 Jan 2020 06:48:59 +0100 Subject: [PATCH] string: typedef std::vector to strlist_t --- src/string.cpp | 8 ++++---- src/string.h | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/string.cpp b/src/string.cpp index e2765a9..91eed0e 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -25,16 +25,16 @@ #include #include "string.h" -std::vector strsplitwords(const std::string& str, const std::string& delim) { +strlist_t strsplitwords(const std::string& str, const std::string& delim) { - std::vector words = strsplit(str, delim); + strlist_t words = strsplit(str, delim); std::for_each(words.begin(), words.end(), trim); return words; } -std::vector strsplit(const std::string& str, const std::string& delim) { +strlist_t strsplit(const std::string& str, const std::string& delim) { - std::vector r; + strlist_t r; size_t s = 0, e = 0, dlen = delim.length(); while((e = str.find(delim, s)) != std::string::npos) { diff --git a/src/string.h b/src/string.h index 2466878..9c8bf67 100644 --- a/src/string.h +++ b/src/string.h @@ -27,9 +27,11 @@ #include #include -std::vector strsplitwords(const std::string& str, const std::string& delim = ","); +typedef std::vector strlist_t; -std::vector strsplit(const std::string& str, const std::string& delim); +strlist_t strsplitwords(const std::string& str, const std::string& delim = ","); + +strlist_t strsplit(const std::string& str, const std::string& delim); std::string& strtolower(std::string& str);