2014-08-03 15:50:28 -04:00
|
|
|
/*
|
2016-01-14 16:50:22 -05:00
|
|
|
Copyright (c) 2016, Antonio SJ Musumeci <trapexit@spawn.link>
|
|
|
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
|
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
2014-08-03 15:50:28 -04:00
|
|
|
*/
|
|
|
|
|
|
2017-06-30 11:15:20 -04:00
|
|
|
#pragma once
|
2016-12-22 22:46:20 -05:00
|
|
|
|
2014-08-03 15:50:28 -04:00
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
namespace str
|
|
|
|
|
{
|
2014-11-10 21:01:20 -05:00
|
|
|
void
|
2016-01-29 16:54:39 -05:00
|
|
|
split(std::vector<std::string> &result,
|
|
|
|
|
const char *str,
|
|
|
|
|
const char delimiter);
|
|
|
|
|
void
|
2014-11-10 21:01:20 -05:00
|
|
|
split(std::vector<std::string> &result,
|
|
|
|
|
const std::string &str,
|
|
|
|
|
const char delimiter);
|
2014-08-03 15:50:28 -04:00
|
|
|
|
2019-09-24 10:27:46 -04:00
|
|
|
void
|
|
|
|
|
splitkv(const std::string &str,
|
|
|
|
|
const char delimiter,
|
|
|
|
|
std::string *key,
|
|
|
|
|
std::string *value);
|
|
|
|
|
|
2014-11-10 21:01:20 -05:00
|
|
|
std::string
|
|
|
|
|
join(const std::vector<std::string> &vec,
|
2015-01-22 16:30:12 -05:00
|
|
|
const size_t substridx,
|
2014-11-10 21:01:20 -05:00
|
|
|
const char sep);
|
2015-01-22 16:30:12 -05:00
|
|
|
|
|
|
|
|
std::string
|
|
|
|
|
join(const std::vector<std::string> &vec,
|
|
|
|
|
const char sep);
|
|
|
|
|
|
|
|
|
|
size_t
|
|
|
|
|
longest_common_prefix_index(const std::vector<std::string> &vec);
|
|
|
|
|
|
|
|
|
|
std::string
|
|
|
|
|
longest_common_prefix(const std::vector<std::string> &vec);
|
|
|
|
|
|
|
|
|
|
std::string
|
|
|
|
|
remove_common_prefix_and_join(const std::vector<std::string> &vec,
|
|
|
|
|
const char sep);
|
2015-02-19 09:09:24 -05:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
erase_fnmatches(const std::vector<std::string> &pattern,
|
|
|
|
|
std::vector<std::string> &strs);
|
2015-09-03 16:56:54 -04:00
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
isprefix(const std::string &s0,
|
|
|
|
|
const std::string &s1);
|
2018-10-20 23:40:02 -04:00
|
|
|
|
|
|
|
|
bool
|
2019-09-24 10:27:46 -04:00
|
|
|
startswith(const std::string &str_,
|
|
|
|
|
const std::string &prefix_);
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
endswith(const std::string &str_,
|
|
|
|
|
const std::string &suffix_);
|
|
|
|
|
|
|
|
|
|
std::string
|
|
|
|
|
trim(const std::string &str);
|
2014-08-03 15:50:28 -04:00
|
|
|
}
|