Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
Functions
string.h File Reference
#include <util/spanparsing.h>
#include <array>
#include <cstdint>
#include <cstring>
#include <locale>
#include <sstream>
#include <string>
#include <string_view>
#include <vector>
Include dependency graph for string.h:

Go to the source code of this file.

Functions

void ReplaceAll (std::string &in_out, const std::string &search, const std::string &substitute)
 
std::vector< std::string > SplitString (std::string_view str, char sep)
 
std::string_view TrimStringView (std::string_view str, std::string_view pattern=" \f\n\r\t\v")
 
std::string TrimString (std::string_view str, std::string_view pattern=" \f\n\r\t\v")
 
std::string_view RemovePrefixView (std::string_view str, std::string_view prefix)
 
std::string RemovePrefix (std::string_view str, std::string_view prefix)
 
template<typename T , typename BaseType , typename UnaryOp >
auto Join (const std::vector< T > &list, const BaseType &separator, UnaryOp unary_op) -> decltype(unary_op(list.at(0)))
 Join a list of items.
 
template<typename T , typename T2 >
Join (const std::vector< T > &list, const T2 &separator)
 
std::string Join (const std::vector< std::string > &list, std::string_view separator)
 
bool ContainsNoNUL (std::string_view str) noexcept
 Check if a string does not contain any embedded NUL (\0) characters.
 
template<typename T >
std::string ToString (const T &t)
 Locale-independent version of std::to_string.
 
template<typename T1 , size_t PREFIX_LEN>
bool HasPrefix (const T1 &obj, const std::array< uint8_t, PREFIX_LEN > &prefix)
 Check whether a container begins with the given prefix.
 

Function Documentation

◆ ContainsNoNUL()

bool ContainsNoNUL ( std::string_view  str)
inlinenoexcept

Check if a string does not contain any embedded NUL (\0) characters.

Definition at line 90 of file string.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HasPrefix()

template<typename T1 , size_t PREFIX_LEN>
bool HasPrefix ( const T1 obj,
const std::array< uint8_t, PREFIX_LEN > &  prefix 
)
inline

Check whether a container begins with the given prefix.

Definition at line 112 of file string.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Join() [1/3]

std::string Join ( const std::vector< std::string > &  list,
std::string_view  separator 
)
inline

Definition at line 82 of file string.h.

Here is the call graph for this function:

◆ Join() [2/3]

auto Join ( const std::vector< T > &  list,
const BaseType separator,
UnaryOp  unary_op 
) -> decltype(unary_op(list.at(0)))

Join a list of items.

Parameters
listThe list to join
separatorThe separator
unary_opApply this operator to each item in the list

Definition at line 63 of file string.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Join() [3/3]

template<typename T , typename T2 >
T Join ( const std::vector< T > &  list,
const T2 separator 
)

Definition at line 76 of file string.h.

Here is the call graph for this function:

◆ RemovePrefix()

std::string RemovePrefix ( std::string_view  str,
std::string_view  prefix 
)
inline

Definition at line 50 of file string.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RemovePrefixView()

std::string_view RemovePrefixView ( std::string_view  str,
std::string_view  prefix 
)
inline

Definition at line 43 of file string.h.

Here is the caller graph for this function:

◆ ReplaceAll()

void ReplaceAll ( std::string &  in_out,
const std::string &  search,
const std::string &  substitute 
)

Definition at line 10 of file string.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SplitString()

std::vector< std::string > SplitString ( std::string_view  str,
char  sep 
)
inline

Definition at line 22 of file string.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ToString()

template<typename T >
std::string ToString ( const T &  t)

Locale-independent version of std::to_string.

Definition at line 100 of file string.h.

Here is the call graph for this function:

◆ TrimString()

std::string TrimString ( std::string_view  str,
std::string_view  pattern = " \f\n\r\t\v" 
)
inline

Definition at line 38 of file string.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TrimStringView()

std::string_view TrimStringView ( std::string_view  str,
std::string_view  pattern = " \f\n\r\t\v" 
)
inline

Definition at line 28 of file string.h.

Here is the call graph for this function:
Here is the caller graph for this function: