mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-30 15:54:03 +02:00
Wrap boost::replace_all
This commit is contained in:
@@ -3,3 +3,10 @@
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <util/string.h>
|
||||
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
|
||||
void ReplaceAll(std::string& in_out, std::string_view search, std::string_view substitute)
|
||||
{
|
||||
boost::replace_all(in_out, search, substitute);
|
||||
}
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
#ifndef BITCOIN_UTIL_STRING_H
|
||||
#define BITCOIN_UTIL_STRING_H
|
||||
|
||||
#include <attributes.h>
|
||||
#include <util/spanparsing.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <locale>
|
||||
#include <sstream>
|
||||
@@ -17,6 +17,8 @@
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
void ReplaceAll(std::string& in_out, std::string_view search, std::string_view substitute);
|
||||
|
||||
[[nodiscard]] inline std::vector<std::string> SplitString(std::string_view str, char sep)
|
||||
{
|
||||
return spanparsing::Split<std::string>(str, sep);
|
||||
|
||||
@@ -76,7 +76,6 @@
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <univalue.h>
|
||||
|
||||
#include <fstream>
|
||||
@@ -1253,7 +1252,7 @@ fs::path GetSpecialFolderPath(int nFolder, bool fCreate)
|
||||
std::string ShellEscape(const std::string& arg)
|
||||
{
|
||||
std::string escaped = arg;
|
||||
boost::replace_all(escaped, "'", "'\"'\"'");
|
||||
ReplaceAll(escaped, "'", "'\"'\"'");
|
||||
return "'" + escaped + "'";
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user