[DEV] update some API
This commit is contained in:
parent
15295165a3
commit
f3d93713c0
@ -804,12 +804,18 @@ bool etk::start_with(const std::string& _obj, const std::string& _val, bool _cas
|
|||||||
|
|
||||||
std::string etk::replace(const std::string& _obj, char _val, char _replace) {
|
std::string etk::replace(const std::string& _obj, char _val, char _replace) {
|
||||||
std::string copy(_obj);
|
std::string copy(_obj);
|
||||||
for( size_t iii = 0;
|
std::replace(copy.begin(), copy.end(), _val, _replace);
|
||||||
iii < copy.size();
|
return copy;
|
||||||
iii++) {
|
|
||||||
if (copy[iii] == _val) {
|
}
|
||||||
copy[iii] = _replace;
|
|
||||||
}
|
//! @not_in_doc
|
||||||
|
std::string etk::replace(const std::string& _obj, const std::string& _val, const std::string& _replace) {
|
||||||
|
std::string copy(_obj);
|
||||||
|
size_t pos = 0;
|
||||||
|
while ((pos = copy.find(_val, pos)) != std::string::npos) {
|
||||||
|
copy.replace(pos, _val.length(), _replace);
|
||||||
|
pos += _replace.length();
|
||||||
}
|
}
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
@ -617,6 +617,8 @@ namespace etk {
|
|||||||
std::u32string replace(const std::u32string& _obj, char32_t _val, char32_t _replace);
|
std::u32string replace(const std::u32string& _obj, char32_t _val, char32_t _replace);
|
||||||
#endif
|
#endif
|
||||||
//! @not_in_doc
|
//! @not_in_doc
|
||||||
|
std::string replace(const std::string& _obj, const std::string& _val, const std::string& _replace);
|
||||||
|
//! @not_in_doc
|
||||||
std::string extract_line(const std::string& _obj, int32_t _pos);
|
std::string extract_line(const std::string& _obj, int32_t _pos);
|
||||||
#if __CPP_VERSION__ >= 2011
|
#if __CPP_VERSION__ >= 2011
|
||||||
//! @previous
|
//! @previous
|
||||||
|
Loading…
x
Reference in New Issue
Block a user