2014-08-04 03:50:28 +08:00
|
|
|
/*
|
2016-01-15 05:50:22 +08: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-04 03:50:28 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace str
|
|
|
|
{
|
2014-11-11 10:01:20 +08:00
|
|
|
void
|
|
|
|
split(std::vector<std::string> &result,
|
|
|
|
const std::string &str,
|
|
|
|
const char delimiter);
|
2014-08-04 03:50:28 +08:00
|
|
|
|
2014-11-11 10:01:20 +08:00
|
|
|
std::string
|
|
|
|
join(const std::vector<std::string> &vec,
|
2015-01-23 05:30:12 +08:00
|
|
|
const size_t substridx,
|
2014-11-11 10:01:20 +08:00
|
|
|
const char sep);
|
2015-01-23 05:30:12 +08: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 22:09:24 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
erase_fnmatches(const std::vector<std::string> &pattern,
|
|
|
|
std::vector<std::string> &strs);
|
2015-09-04 04:56:54 +08:00
|
|
|
|
|
|
|
bool
|
|
|
|
isprefix(const std::string &s0,
|
|
|
|
const std::string &s1);
|
2014-08-04 03:50:28 +08:00
|
|
|
}
|