simstr 1.2.4
Yet another strings library
 
Loading...
Searching...
No Matches
simstr::str_mutable< K, Impl > Class Template Reference

Base class for working with mutable strings. More...

#include <sstring.h>

Inheritance diagram for simstr::str_mutable< K, Impl >:
simstr::lstring< K, N, forShared, Allocator > simstr::lstring< u8s, N > simstr::lstring< wchar_t, N > simstr::lstring< u16s, N > simstr::lstring< u32s, N > simstr::lstring< u8s, N, true > simstr::lstring< wchar_t, N, true > simstr::lstring< u16s, N, true > simstr::lstring< u32s, N, true >

Public Member Functions

K * str () noexcept
 Get a pointer to the string buffer.
 
 operator K* () noexcept
 Get a pointer to the string buffer.
 
Impl & trim ()
 Remove whitespace from the beginning and end of a line.
 
Impl & trim_left ()
 Remove whitespace at the beginning of a line.
 
Impl & trim_right ()
 Remove whitespace from the end of a line.
 
template<typename T, size_t N = const_lit_for<K, T>::Count>
requires is_const_pattern<N>
Impl & trim (T &&pattern)
 Remove characters included in a string literal at the beginning and end of the line.
 
template<typename T, size_t N = const_lit_for<K, T>::Count>
requires is_const_pattern<N>
Impl & trim_left (T &&pattern)
 Remove characters included in a string literal at the beginning of the line.
 
template<typename T, size_t N = const_lit_for<K, T>::Count>
requires is_const_pattern<N>
Impl & trim_right (T &&pattern)
 Remove characters included in a string literal at the end of the line.
 
template<typename T, size_t N = const_lit_for<K, T>::Count>
requires is_const_pattern<N>
Impl & trim_with_spaces (T &&pattern)
 Remove characters included in a string literal, as well as whitespace, at the beginning and end of the string.
 
template<typename T, size_t N = const_lit_for<K, T>::Count>
requires is_const_pattern<N>
Impl & trim_left_with_spaces (T &&pattern)
 Remove characters included in a string literal, as well as whitespace, at the beginning of a line.
 
template<typename T, size_t N = const_lit_for<K, T>::Count>
requires is_const_pattern<N>
Impl & trim_right_with_wpaces (T &&pattern)
 Remove characters included in a string literal, as well as whitespace, at the end of a string.
 
Impl & trim (str_piece pattern)
 Remove characters included in the passed string at the beginning and end of the line.
 
Impl & trim_left (str_piece pattern)
 Remove characters included in the passed string at the beginning of the line.
 
Impl & trim_right (str_piece pattern)
 Remove characters included in the passed string from the end of the string.
 
Impl & trim_with_spaces (str_piece pattern)
 Remove characters included in the passed string, as well as whitespace characters, at the beginning and end of the string.
 
Impl & trim_left_with_spaces (str_piece pattern)
 Remove characters included in the passed string, as well as whitespace, at the beginning of the string.
 
Impl & trim_right_with_spaces (str_piece pattern)
 Remove characters included in the passed string, as well as whitespace at the end of the string.
 
Impl & upper_only_ascii ()
 Convert ASCII characters to uppercase.
 
Impl & lower_only_ascii ()
 Convert ASCII characters to lowercase.
 
Impl & upper ()
 Convert first plane characters (<0xFFFF) to uppercase Unicode.
 
Impl & lower ()
 Convert first plane characters (<0xFFFF) to lowercase Unicode.
 
Impl & append (str_piece other)
 Add another line to the end of the line.
 
template<StrExprForType< K > A>
Impl & append (const A &expr)
 Add a string expression to the end of the line.
 
Impl & operator+= (str_piece other)
 Add another line to the end of the line.
 
template<StrExprForType< K > A>
Impl & operator+= (const A &expr)
 Add a string expression to the end of the line.
 
Impl & append_in (size_t pos, str_piece other)
 Add another line starting at the given position.
 
template<StrExprForType< K > A>
Impl & append_in (size_t pos, const A &expr)
 Add a string expression starting at the given position.
 
Impl & change (size_t from, size_t len, str_piece other)
 Replace a piece of string with another string.
 
template<StrExprForType< K > A>
Impl & change (size_t from, size_t len, const A &expr)
 Replace a piece of string with a string expression.
 
Impl & insert (size_t to, str_piece other)
 Insert a line at the specified position.
 
template<StrExprForType< K > A>
Impl & insert (size_t to, const A &expr)
 Insert a string expression at the specified position.
 
Impl & remove (size_t from, size_t len)
 Remove part of a line.
 
Impl & prepend (str_piece other)
 Add another line to the beginning of the line.
 
template<StrExprForType< K > A>
Impl & prepend (const A &expr)
 Add a string expression to the beginning of a line.
 
Impl & replace (str_piece pattern, str_piece repl, size_t offset=0, size_t maxCount=0)
 Replace occurrences of a substring with another string.
 
template<StrType< K > From>
Impl & replace_from (const From &f, str_piece pattern, str_piece repl, size_t offset=0, size_t maxCount=0)
 Copy the source string, replacing occurrences of substrings with another string.
 
template<typename Op>
Impl & fill (size_t from, const Op &fillFunction)
 Fill a string buffer using a functor.
 
template<typename Op>
requires std::is_invocable_v<Op, K*, size_t>
Impl & operator<< (const Op &fillFunction)
 Fills a string with the fill method from position zero.
 
template<typename Op>
requires std::is_invocable_v<Op, K*, size_t>
Impl & operator<<= (const Op &fillFunction)
 Fills a string with the fill method after the end of the string.
 
template<typename Op>
requires std::is_invocable_v<Op, my_type&>
Impl & operator<< (const Op &fillFunction)
 Calls the passed functor, passing a reference to itself.
 
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & printf_from (size_t from, const K *format, T &&... args)
 Appends sprintf formatted output starting at the specified position.
 
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & printf (const K *format, T &&... args)
 Formats a string using sprintf.
 
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & append_printf (const K *format, T &&... args)
 Appends sprintf formatted output to the end of the line.
 
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & format_from (size_t from, const FmtString< K, T... > &format, T &&... args)
 Appends std::format-formatted output starting at the specified position.
 
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & vformat_from (size_t from, size_t max_write, str_piece format, T &&... args)
 Appends std::vformat formatted output starting at the specified position.
 
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & format (const FmtString< K, T... > &pattern, T &&... args)
 Formats a string using std::format.
 
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & append_formatted (const FmtString< K, T... > &format, T &&... args)
 Appends std::format-formatted output to the end of the line.
 
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & vformat (str_piece format, T &&... args)
 Formats a string using std::vformat.
 
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & append_vformatted (str_piece format, T &&... args)
 Appends std::vformat-formatted output to the end of the line.
 
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & vformat_n (size_t max_write, str_piece format, T &&... args)
 Formats a string using std::vformat up to the specified size.
 
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & append_vformatted_n (size_t max_write, str_piece format, T &&... args)
 Appends std::vformat-formatted output to the end of the line, writing no more than the specified number of characters.
 
template<typename Op, typename... Args>
Impl & with (const Op &fillFunction, Args &&... args)
 Call a functor with a string and passed arguments.
 

Detailed Description

template<typename K, typename Impl>
class simstr::str_mutable< K, Impl >

Base class for working with mutable strings.

Template Parameters
K- character type
Impl- the final type of the successor

Still knows nothing about where the heir stores the string and its size. Simply calls its methods to get the space, and fills it as needed. To work, the descendant class must implement the following methods:

  • size_t length() const noexcept - returns the length of the string
  • const K* symbols() const - returns a pointer to the beginning of the line
  • bool is_empty() const noexcept - checks whether the string is empty
  • K* str() noexcept - Non-const pointer to the beginning of the string
  • K* set_size(size_t size) - Change the size of the string, either larger or smaller. The contents of the line must be left.
  • K* reserve_no_preserve(size_t size) - allocate space for a line, you don’t have to save the old one
  • K* alloc_for_copy(size_t size) - allocate space for a copy of a string of a given size, without changing it yet the string itself, you can return the current buffer if space allows.
  • set_from_copy(K* str, size_t size) - assign a string from memory previously allocated in alloc_for_copy. If space was allocated in the current buffer, do nothing.
  • size_t capacity() const noexcept - return the current capacity of the string, as much as can fit without allocation.

Member Function Documentation

◆ append() [1/2]

template<typename K, typename Impl>
template<StrExprForType< K > A>
Impl & simstr::str_mutable< K, Impl >::append ( const A & expr)
inline

Add a string expression to the end of the line.

Parameters
expr- string expression.
Returns
Impl& - a reference to yourself.

◆ append() [2/2]

template<typename K, typename Impl>
Impl & simstr::str_mutable< K, Impl >::append ( str_piece other)
inline

Add another line to the end of the line.

Parameters
other- another string.
Returns
Impl& - a reference to yourself.

◆ append_formatted()

template<typename K, typename Impl>
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & simstr::str_mutable< K, Impl >::append_formatted ( const FmtString< K, T... > & format,
T &&... args )
inline

Appends std::format-formatted output to the end of the line.

Parameters
format- format string, constant.
...args- arguments for std::format.
Returns
Impl& - a reference to yourself.

Automatically increases the string buffer size if necessary.

◆ append_in() [1/2]

template<typename K, typename Impl>
template<StrExprForType< K > A>
Impl & simstr::str_mutable< K, Impl >::append_in ( size_t pos,
const A & expr )
inline

Add a string expression starting at the given position.

Parameters
pos- the position from which to add. First, the string is shortened to the specified value size, and then a string expression is added.
expr- string expression.
Returns
Impl& - a reference to yourself.

If the string is longer than pos, then it is shortened to this size, and then expr is added.

◆ append_in() [2/2]

template<typename K, typename Impl>
Impl & simstr::str_mutable< K, Impl >::append_in ( size_t pos,
str_piece other )
inline

Add another line starting at the given position.

Parameters
pos- the position from which to add. First, the string is shortened to the specified value size, and then another line is added.
other- another string.
Returns
Impl& - a reference to yourself.

If the string is longer than pos, then it is shortened to this size, and then other is added.

◆ append_printf()

template<typename K, typename Impl>
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & simstr::str_mutable< K, Impl >::append_printf ( const K * format,
T &&... args )
inline

Appends sprintf formatted output to the end of the line.

Parameters
format- format string.
...args- arguments for sprintf.
Returns
Impl& - a reference to yourself.

Automatically increases the row buffer size if necessary.

◆ append_vformatted()

template<typename K, typename Impl>
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & simstr::str_mutable< K, Impl >::append_vformatted ( str_piece format,
T &&... args )
inline

Appends std::vformat-formatted output to the end of the line.

Parameters
format- format string.
...- arguments for std::vformat.
Returns
Impl& - a reference to yourself.

Automatically increases the string buffer size if necessary.

◆ append_vformatted_n()

template<typename K, typename Impl>
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & simstr::str_mutable< K, Impl >::append_vformatted_n ( size_t max_write,
str_piece format,
T &&... args )
inline

Appends std::vformat-formatted output to the end of the line, writing no more than the specified number of characters.

Parameters
max_write- the maximum number of characters to write.
format- format string.
...args- arguments for std::vformat.
Returns
Impl& - a reference to yourself.

Automatically increases the string buffer size if necessary.

◆ change() [1/2]

template<typename K, typename Impl>
template<StrExprForType< K > A>
Impl & simstr::str_mutable< K, Impl >::change ( size_t from,
size_t len,
const A & expr )
inline

Replace a piece of string with a string expression.

Parameters
from- starting position for replacement.
len- length of the part to be replaced.
expr- string expression.
Returns
Impl& - a reference to yourself.

◆ change() [2/2]

template<typename K, typename Impl>
Impl & simstr::str_mutable< K, Impl >::change ( size_t from,
size_t len,
str_piece other )
inline

Replace a piece of string with another string.

Parameters
from- starting position for replacement.
len- length of the part to be replaced.
other- the string this part is changed to.
Returns
Impl& - a reference to yourself.

◆ fill()

template<typename K, typename Impl>
template<typename Op>
Impl & simstr::str_mutable< K, Impl >::fill ( size_t from,
const Op & fillFunction )
inline

Fill a string buffer using a functor.

Parameters
from- starting position to fill.
fillFunction- size_t(K*, size_t) functor that receives the address of the string buffer and its capacity, returning the required string size.
Returns
Impl& - a reference to yourself.

The function calls the functor, passing it the address of the string buffer and its capacity. The functor can modify the buffer within the allocated capacity, and must return the size of the resulting string. As long as the returned size is larger than capacity (i.e. the string cannot fit into the buffer), memory of at least the returned size is allocated and the functor is called again. Until the returned size fits into the string buffer. This size becomes the length of the line.

◆ format()

template<typename K, typename Impl>
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & simstr::str_mutable< K, Impl >::format ( const FmtString< K, T... > & pattern,
T &&... args )
inline

Formats a string using std::format.

Parameters
pattern- format string, constant.
...args- arguments for std::format.
Returns
Impl& - a reference to yourself.

Automatically increases the string buffer size if necessary.

◆ format_from()

template<typename K, typename Impl>
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & simstr::str_mutable< K, Impl >::format_from ( size_t from,
const FmtString< K, T... > & format,
T &&... args )
inline

Appends std::format-formatted output starting at the specified position.

Parameters
from- starting position of adding.
format- format string, constant.
...args- arguments for std::format.
Returns
Impl& - a reference to yourself.

Automatically increases the string buffer size if necessary.

◆ insert() [1/2]

template<typename K, typename Impl>
template<StrExprForType< K > A>
Impl & simstr::str_mutable< K, Impl >::insert ( size_t to,
const A & expr )
inline

Insert a string expression at the specified position.

Parameters
to- insertion position.
expr- string expression.
Returns
Impl& - a reference to yourself.

◆ insert() [2/2]

template<typename K, typename Impl>
Impl & simstr::str_mutable< K, Impl >::insert ( size_t to,
str_piece other )
inline

Insert a line at the specified position.

Parameters
to- insertion position.
other- the string to be inserted.
Returns
Impl& - a reference to yourself.

◆ lower()

template<typename K, typename Impl>
Impl & simstr::str_mutable< K, Impl >::lower ( )
inline

Convert first plane characters (<0xFFFF) to lowercase Unicode.

Case is changed by simplified tables, where one code_point is always changed to one code_point (but for UTF-8 it is possible that the length in code units will change).

Returns
Impl& - a reference to yourself.

◆ lower_only_ascii()

template<typename K, typename Impl>
Impl & simstr::str_mutable< K, Impl >::lower_only_ascii ( )
inline

Convert ASCII characters to lowercase.

Returns
Impl& - a reference to yourself.

◆ operator K*()

template<typename K, typename Impl>
simstr::str_mutable< K, Impl >::operator K* ( )
inlineexplicitnoexcept

Get a pointer to the string buffer.

Returns
K* - pointer to the string buffer.

◆ operator+=() [1/2]

template<typename K, typename Impl>
template<StrExprForType< K > A>
Impl & simstr::str_mutable< K, Impl >::operator+= ( const A & expr)
inline

Add a string expression to the end of the line.

Parameters
expr- string expression.
Returns
Impl& - a reference to yourself.

◆ operator+=() [2/2]

template<typename K, typename Impl>
Impl & simstr::str_mutable< K, Impl >::operator+= ( str_piece other)
inline

Add another line to the end of the line.

Parameters
other- another line.
Returns
Impl& - a reference to yourself.

◆ operator<<() [1/2]

template<typename K, typename Impl>
template<typename Op>
requires std::is_invocable_v<Op, K*, size_t>
Impl & simstr::str_mutable< K, Impl >::operator<< ( const Op & fillFunction)
inline

Fills a string with the fill method from position zero.

Parameters
fillFunction- string filling functor, size_t(K*, size_t).
Returns
Impl& - a reference to yourself.

◆ operator<<() [2/2]

template<typename K, typename Impl>
template<typename Op>
requires std::is_invocable_v<Op, my_type&>
Impl & simstr::str_mutable< K, Impl >::operator<< ( const Op & fillFunction)
inline

Calls the passed functor, passing a reference to itself.

Parameters
fillFunction- фуктор void(my_type&).
Returns
Impl& - a reference to yourself.

◆ operator<<=()

template<typename K, typename Impl>
template<typename Op>
requires std::is_invocable_v<Op, K*, size_t>
Impl & simstr::str_mutable< K, Impl >::operator<<= ( const Op & fillFunction)
inline

Fills a string with the fill method after the end of the string.

Parameters
fillFunction- string filling functor, size_t(K*, size_t).
Returns
Impl& - a reference to yourself.

◆ prepend() [1/2]

template<typename K, typename Impl>
template<StrExprForType< K > A>
Impl & simstr::str_mutable< K, Impl >::prepend ( const A & expr)
inline

Add a string expression to the beginning of a line.

Parameters
expr- string expression.
Returns
Impl& - a reference to yourself.

◆ prepend() [2/2]

template<typename K, typename Impl>
Impl & simstr::str_mutable< K, Impl >::prepend ( str_piece other)
inline

Add another line to the beginning of the line.

Parameters
other- another string.
Returns
Impl& - a reference to yourself.

◆ printf()

template<typename K, typename Impl>
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & simstr::str_mutable< K, Impl >::printf ( const K * format,
T &&... args )
inline

Formats a string using sprintf.

Parameters
format- format string.
...args- arguments for sprintf.
Returns
Impl& - a reference to yourself.

Automatically increases the string buffer size if necessary.

◆ printf_from()

template<typename K, typename Impl>
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & simstr::str_mutable< K, Impl >::printf_from ( size_t from,
const K * format,
T &&... args )
inline

Appends sprintf formatted output starting at the specified position.

Parameters
from- starting position of adding.
format- format string.
...args- arguments for sprintf.
Returns
Impl& - a reference to yourself.

Automatically increases the string buffer size if necessary.

◆ remove()

template<typename K, typename Impl>
Impl & simstr::str_mutable< K, Impl >::remove ( size_t from,
size_t len )
inline

Remove part of a line.

Parameters
from- the position from which to delete.
len- length of the part to be deleted.
Returns
Impl& - a reference to yourself.

◆ replace()

template<typename K, typename Impl>
Impl & simstr::str_mutable< K, Impl >::replace ( str_piece pattern,
str_piece repl,
size_t offset = 0,
size_t maxCount = 0 )
inline

Replace occurrences of a substring with another string.

Parameters
pattern- the substring to search for.
repl- replacement string.
offset- the starting position for the search.
maxCount- maximum number of replacements, 0 - no restrictions.
Returns
Impl& - a reference to yourself.

◆ replace_from()

template<typename K, typename Impl>
template<StrType< K > From>
Impl & simstr::str_mutable< K, Impl >::replace_from ( const From & f,
str_piece pattern,
str_piece repl,
size_t offset = 0,
size_t maxCount = 0 )
inline

Copy the source string, replacing occurrences of substrings with another string.

Parameters
f- source string.
pattern- the substring to search for.
repl- replacement string.
offset- the starting position for the search.
maxCount- maximum number of replacements, 0 - no restrictions.
Returns
Impl& - a reference to yourself.

◆ str()

template<typename K, typename Impl>
K * simstr::str_mutable< K, Impl >::str ( )
inlinenoexcept

Get a pointer to the string buffer.

Returns
K* - pointer to the string buffer.

◆ trim() [1/3]

template<typename K, typename Impl>
Impl & simstr::str_mutable< K, Impl >::trim ( )
inline

Remove whitespace from the beginning and end of a line.

Returns
Impl& - a reference to yourself.

◆ trim() [2/3]

template<typename K, typename Impl>
Impl & simstr::str_mutable< K, Impl >::trim ( str_piece pattern)
inline

Remove characters included in the passed string at the beginning and end of the line.

Parameters
pattern- a string containing the characters to be removed.
Returns
Impl& - a reference to yourself.

◆ trim() [3/3]

template<typename K, typename Impl>
template<typename T, size_t N = const_lit_for<K, T>::Count>
requires is_const_pattern<N>
Impl & simstr::str_mutable< K, Impl >::trim ( T && pattern)
inline

Remove characters included in a string literal at the beginning and end of the line.

Parameters
patternis a string literal containing the characters to be removed.
Returns
Impl& - a reference to yourself.

◆ trim_left() [1/3]

template<typename K, typename Impl>
Impl & simstr::str_mutable< K, Impl >::trim_left ( )
inline

Remove whitespace at the beginning of a line.

Returns
Impl& - a reference to yourself.

◆ trim_left() [2/3]

template<typename K, typename Impl>
Impl & simstr::str_mutable< K, Impl >::trim_left ( str_piece pattern)
inline

Remove characters included in the passed string at the beginning of the line.

Parameters
pattern- a string containing the characters to be removed.
Returns
Impl& - a reference to yourself.

◆ trim_left() [3/3]

template<typename K, typename Impl>
template<typename T, size_t N = const_lit_for<K, T>::Count>
requires is_const_pattern<N>
Impl & simstr::str_mutable< K, Impl >::trim_left ( T && pattern)
inline

Remove characters included in a string literal at the beginning of the line.

Parameters
patternis a string literal containing the characters to be removed.
Returns
Impl& - a reference to yourself.

◆ trim_left_with_spaces() [1/2]

template<typename K, typename Impl>
Impl & simstr::str_mutable< K, Impl >::trim_left_with_spaces ( str_piece pattern)
inline

Remove characters included in the passed string, as well as whitespace, at the beginning of the string.

Parameters
pattern- a string containing the characters to be removed.
Returns
Impl& - a reference to yourself.

◆ trim_left_with_spaces() [2/2]

template<typename K, typename Impl>
template<typename T, size_t N = const_lit_for<K, T>::Count>
requires is_const_pattern<N>
Impl & simstr::str_mutable< K, Impl >::trim_left_with_spaces ( T && pattern)
inline

Remove characters included in a string literal, as well as whitespace, at the beginning of a line.

Parameters
patternis a string literal containing the characters to be removed.
  • Returns
    Impl& - a reference to yourself.

◆ trim_right() [1/3]

template<typename K, typename Impl>
Impl & simstr::str_mutable< K, Impl >::trim_right ( )
inline

Remove whitespace from the end of a line.

Returns
Impl& - a reference to yourself.

◆ trim_right() [2/3]

template<typename K, typename Impl>
Impl & simstr::str_mutable< K, Impl >::trim_right ( str_piece pattern)
inline

Remove characters included in the passed string from the end of the string.

Parameters
pattern- a string containing the characters to be removed.
Returns
Impl& - a reference to yourself.

◆ trim_right() [3/3]

template<typename K, typename Impl>
template<typename T, size_t N = const_lit_for<K, T>::Count>
requires is_const_pattern<N>
Impl & simstr::str_mutable< K, Impl >::trim_right ( T && pattern)
inline

Remove characters included in a string literal at the end of the line.

Parameters
patternis a string literal containing the characters to be removed.
Returns
Impl& - a reference to yourself.

◆ trim_right_with_spaces()

template<typename K, typename Impl>
Impl & simstr::str_mutable< K, Impl >::trim_right_with_spaces ( str_piece pattern)
inline

Remove characters included in the passed string, as well as whitespace at the end of the string.

Parameters
pattern- a string containing the characters to be removed.
Returns
Impl& - a reference to yourself.

◆ trim_right_with_wpaces()

template<typename K, typename Impl>
template<typename T, size_t N = const_lit_for<K, T>::Count>
requires is_const_pattern<N>
Impl & simstr::str_mutable< K, Impl >::trim_right_with_wpaces ( T && pattern)
inline

Remove characters included in a string literal, as well as whitespace, at the end of a string.

Parameters
patternis a string literal containing the characters to be removed.
Returns
Impl& - a reference to yourself.

◆ trim_with_spaces() [1/2]

template<typename K, typename Impl>
Impl & simstr::str_mutable< K, Impl >::trim_with_spaces ( str_piece pattern)
inline

Remove characters included in the passed string, as well as whitespace characters, at the beginning and end of the string.

Parameters
pattern- a string containing the characters to be removed.
Returns
Impl& - a reference to yourself.

◆ trim_with_spaces() [2/2]

template<typename K, typename Impl>
template<typename T, size_t N = const_lit_for<K, T>::Count>
requires is_const_pattern<N>
Impl & simstr::str_mutable< K, Impl >::trim_with_spaces ( T && pattern)
inline

Remove characters included in a string literal, as well as whitespace, at the beginning and end of the string.

Parameters
patternis a string literal containing the characters to be removed.
Returns
Impl& - a reference to yourself.

◆ upper()

template<typename K, typename Impl>
Impl & simstr::str_mutable< K, Impl >::upper ( )
inline

Convert first plane characters (<0xFFFF) to uppercase Unicode.

Case is changed by simplified tables, where one code_point is always changed to one code_point (but for UTF-8 it is possible that the length in code units will change).

Returns
Impl& - a reference to yourself.

◆ upper_only_ascii()

template<typename K, typename Impl>
Impl & simstr::str_mutable< K, Impl >::upper_only_ascii ( )
inline

Convert ASCII characters to uppercase.

Returns
Impl& - a reference to yourself.

◆ vformat()

template<typename K, typename Impl>
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & simstr::str_mutable< K, Impl >::vformat ( str_piece format,
T &&... args )
inline

Formats a string using std::vformat.

Parameters
format- format string.
...args- arguments for std::vformat.
Returns
Impl& - a reference to yourself.

Automatically increases the string buffer size if necessary.

◆ vformat_from()

template<typename K, typename Impl>
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & simstr::str_mutable< K, Impl >::vformat_from ( size_t from,
size_t max_write,
str_piece format,
T &&... args )
inline

Appends std::vformat formatted output starting at the specified position.

Parameters
from- starting position of adding.
max_write- the maximum number of characters to write.
format- format string.
...args- arguments for std::vformat.
Returns
Impl& - a reference to yourself.

Automatically increases the string buffer size if necessary.

◆ vformat_n()

template<typename K, typename Impl>
template<typename... T>
requires (is_one_of_std_char_v<K>)
Impl & simstr::str_mutable< K, Impl >::vformat_n ( size_t max_write,
str_piece format,
T &&... args )
inline

Formats a string using std::vformat up to the specified size.

Parameters
max_write- the maximum number of characters to write.
format- format string.
...args- arguments for std::vformat.
Returns
Impl& - a reference to yourself.

Automatically increases the string buffer size if necessary.

◆ with()

template<typename K, typename Impl>
template<typename Op, typename... Args>
Impl & simstr::str_mutable< K, Impl >::with ( const Op & fillFunction,
Args &&... args )
inline

Call a functor with a string and passed arguments.

Parameters
fillFunction- a functor that takes a string reference as its first parameter.
...args- arguments passed to the functor.
Returns
Impl& - a reference to yourself.

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