omw  0.2.0
Public Member Functions | List of all members
omw::string Class Reference
Inheritance diagram for omw::string:
std::string

Public Member Functions

 string (omw::string::size_type count, char c)
 
 string (const char *str)
 
 string (const char *str, omw::string::size_type count)
 
 string (const std::string &other)
 
 string (const std::string &other, std::string::size_type pos, std::string::size_type count=std::string::npos)
 
 string (const char *first, const char *last)
 
std::stringstd ()
 
const std::stringstd () const
 
bool contains (char ch) const
 
bool contains (const char *str) const
 
bool contains (const std::string &str) const
 
bool contains (std::string_view sv) const
 
omw::stringreplaceFirst (const std::string &search, const std::string &replace, size_type startPos=0)
 
omw::stringreplaceFirst (const omw::StringReplacePair &pair, size_type startPos=0)
 
omw::stringreplaceAll (char search, char replace, size_type startPos=0, size_t *nReplacements=nullptr)
 
omw::stringreplaceAll (char search, const std::string &replace, size_type startPos=0, size_t *nReplacements=nullptr)
 
omw::stringreplaceAll (const std::string &search, char replace, size_type startPos=0, size_t *nReplacements=nullptr)
 
omw::stringreplaceAll (const std::string &search, const std::string &replace, size_type startPos=0, size_t *nReplacements=nullptr)
 
omw::stringreplaceAll (const omw::StringReplacePair &pair, size_type startPos=0, size_t *nReplacements=nullptr)
 
omw::stringreplaceAll (const std::vector< omw::StringReplacePair > &pairs, size_type startPos=0, size_t *nReplacementsTotal=nullptr, std::vector< size_t > *nReplacements=nullptr)
 
omw::stringreplaceAll (const omw::StringReplacePair *pairs, size_t count, size_type startPos=0, size_t *nReplacementsTotal=nullptr, std::vector< size_t > *nReplacements=nullptr)
 
omw::stringVector_t split (char delimiter, omw::stringVector_t::size_type maxTokenCount=omw::stringVector_npos) const
 
omw::stringVector_t splitLen (omw::string::size_type tokenLength, omw::stringVector_t::size_type maxTokenCount=omw::stringVector_npos) const
 
Case Conversion

Methods named .._ascii convert only A-Z and a-z. Those named .._asciiExt additionally convert some UTF-8 code points.

omw::stringlower_ascii ()
 
omw::stringlower_asciiExt ()
 
omw::stringupper_ascii ()
 
omw::stringupper_asciiExt ()
 
omw::string toLower_ascii () const
 
omw::string toLower_asciiExt () const
 
omw::string toUpper_ascii () const
 
omw::string toUpper_asciiExt () const
 

Detailed Description

A with std::string interchangeable class to add more functionalities. This class does not override/implement any (virtual) methods of the base class and has no attributes. It's basically a std::string with some more methods. However the two constructors which take the other string as a char pointer behave defined if a null pointer is passed.

Member Function Documentation

◆ contains() [1/4]

omw::string::contains ( char  ch) const

until C++23
since C++23 Defined in std::string

Defined in the header.

◆ contains() [2/4]

omw::string::contains ( const char *  str) const

until C++23
since C++23 Defined in std::string

Defined in the header.

◆ contains() [3/4]

omw::string::contains ( const std::string str) const

until C++17

Defined in the header.

◆ contains() [4/4]

omw::string::contains ( std::string_view  sv) const

since C++17
until C++23
since C++23 Defined in std::string

Defined in the header.

◆ replaceAll() [1/7]

omw::string & omw::string::replaceAll ( char  search,
char  replace,
size_type  startPos = 0,
size_t *  nReplacements = nullptr 
)
Parameters
searchCharacter to be replaced
replaceCharacter for replacement
startPosFrom where to start searching
[out]nReplacementsNumber of occurrences
Returns
*this

◆ replaceAll() [2/7]

omw::string & omw::string::replaceAll ( char  search,
const std::string replace,
size_type  startPos = 0,
size_t *  nReplacements = nullptr 
)
Parameters
searchCharacter to be replaced
replaceString for replacement
startPosFrom where to start searching
[out]nReplacementsNumber of occurrences
Returns
*this

◆ replaceAll() [3/7]

omw::string & omw::string::replaceAll ( const omw::StringReplacePair pair,
size_type  startPos = 0,
size_t *  nReplacements = nullptr 
)
Parameters
pairSearch and replace string pair
startPosFrom where to start searching
[out]nReplacementsNumber of occurrences
Returns
*this

◆ replaceAll() [4/7]

omw::string & omw::string::replaceAll ( const omw::StringReplacePair pairs,
size_t  count,
size_type  startPos = 0,
size_t *  nReplacementsTotal = nullptr,
std::vector< size_t > *  nReplacements = nullptr 
)
Parameters
pairsPointer to a replace pair array
count
startPosFrom where to start searching
[out]nReplacementsTotalTotal number of occurrences
[out]nReplacementsNumber of occurrences of specific replace pair
Returns
*this

◆ replaceAll() [5/7]

omw::string & omw::string::replaceAll ( const std::string search,
char  replace,
size_type  startPos = 0,
size_t *  nReplacements = nullptr 
)
Parameters
searchSubstring to be replaced
replaceCharacter for replacement
startPosFrom where to start searching
[out]nReplacementsNumber of occurrences
Returns
*this

◆ replaceAll() [6/7]

omw::string & omw::string::replaceAll ( const std::string search,
const std::string replace,
size_type  startPos = 0,
size_t *  nReplacements = nullptr 
)
Parameters
searchSubstring to be replaced
replaceString for replacement
startPosFrom where to start searching
[out]nReplacementsNumber of occurrences
Returns
*this

◆ replaceAll() [7/7]

omw::string & omw::string::replaceAll ( const std::vector< omw::StringReplacePair > &  pairs,
size_type  startPos = 0,
size_t *  nReplacementsTotal = nullptr,
std::vector< size_t > *  nReplacements = nullptr 
)
Parameters
pairsSearch and replace string pair vector
startPosFrom where to start searching
[out]nReplacementsTotalTotal number of occurrences
[out]nReplacementsNumber of occurrences of specific replace pair
Returns
*this

◆ replaceFirst() [1/2]

omw::string & omw::string::replaceFirst ( const omw::StringReplacePair pair,
size_type  startPos = 0 
)
Parameters
pairSearch and replace string pair
startPosFrom where to start searching
Returns
*this

◆ replaceFirst() [2/2]

omw::string & omw::string::replaceFirst ( const std::string search,
const std::string replace,
size_type  startPos = 0 
)
Parameters
searchSubstring to be replaced
replaceString for replacement
startPosFrom where to start searching
Returns
*this

◆ std()

std::string & omw::string::std ( )

Used if an implicit conversion to std::string is not possible (e.g. passing an omw::string to a function parameter of type std::filesystem::path).


The documentation for this class was generated from the following files: