1
0
Fork 0
mirror of https://github.com/eosswedenorg/antelope-keygen synced 2026-07-02 11:43:40 +02:00

string: typedef std::vector<std::string> to strlist_t

This commit is contained in:
Henrik Hautakoski 2020-01-09 06:48:59 +01:00
parent 372bb3c81e
commit c91d8ac33c
2 changed files with 8 additions and 6 deletions

View file

@ -25,16 +25,16 @@
#include <cctype> #include <cctype>
#include "string.h" #include "string.h"
std::vector<std::string> strsplitwords(const std::string& str, const std::string& delim) { strlist_t strsplitwords(const std::string& str, const std::string& delim) {
std::vector<std::string> words = strsplit(str, delim); strlist_t words = strsplit(str, delim);
std::for_each(words.begin(), words.end(), trim); std::for_each(words.begin(), words.end(), trim);
return words; return words;
} }
std::vector<std::string> strsplit(const std::string& str, const std::string& delim) { strlist_t strsplit(const std::string& str, const std::string& delim) {
std::vector<std::string> r; strlist_t r;
size_t s = 0, e = 0, dlen = delim.length(); size_t s = 0, e = 0, dlen = delim.length();
while((e = str.find(delim, s)) != std::string::npos) { while((e = str.find(delim, s)) != std::string::npos) {

View file

@ -27,9 +27,11 @@
#include <vector> #include <vector>
#include <string> #include <string>
std::vector<std::string> strsplitwords(const std::string& str, const std::string& delim = ","); typedef std::vector<std::string> strlist_t;
std::vector<std::string> 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); std::string& strtolower(std::string& str);