mlisp/ml_string.h

26 lines
1.1 KiB
C++

#pragma once
#include <string>
#include <regex>
void replace_substring(std::string &src, const std::string &substr, const std::string &replacement);
std::string replace_substring_regexp(const std::string &src, const std::string &substr, const std::string &replacement);
// Returns true if where contains regex
bool regexp_search(const std::string &where, const std::string &regex_str);
// Returns list of contained regex patterns
std::vector<std::vector<std::string>> regexp_search2(const std::string &where, const std::string &regex_str, bool match_mode, bool ignore_case);
std::vector<std::string> regexp_strsplit(const std::string &string_to_split, const std::string &rgx_str);
std::string string_lucase(std::string s, const std::string &strcase);
std::string string_trim(std::string s, const std::string &chars_to_trim, const std::string &rltrim);
std::string string_padd(const std::string & str, size_t pad_len, char fill_char, bool from_right);
std::string string_substring(const std::string & str, long pos, size_t count);
long string_find_substr(const std::string & str, const std::string & pattern, size_t pos);