1 #pragma once // Source encoding: UTF-8 with BOM (π is a lowercase Greek "pi"). 25 {
return (n <= 0?
"" :
string( n,
' ')); }
27 inline namespace string_repeat
29 inline auto repeated(
const int n,
const string_view& s )
32 if( n <= 0 ) {
return ""; }
35 result.reserve( n*s.length() );
36 for(
int i = 1; i <= n; ++i )
43 inline auto operator*(
const int n,
const string_view& s )
48 inline auto left(
const string_view& s,
const int width )
52 inline auto right(
const string_view& s,
const int width )
60 inline auto quoted(
const string_view& sv )
72 {
return quoted( string_view( &ch, 1 ) ); }
74 inline auto trimmed(
const string_view& sv )
91 return string_view( p_first, p_beyond - p_first );
96 {
return string(
trimmed( string_view( s ) ) ); }
101 const string_view t =
trimmed( string_view( s ) );
102 if( t.length() == s.length() )
112 inline auto split() -> void;
114 template<
class Iterator >
117 const string& separator =
" " 120 if(
is_empty( range ) ) {
return ""; }
122 string result = range.front();
auto n_code_points_in(const string_view &view) -> Size
Some_type * P_
Creates a raw pointer type.
auto left(const string_view &s, const int width) -> string
auto operator *(const int n, const string_view &s) -> string
auto all_but_first_of(Container &&c) -> Span_< decltype(begin(c))>
auto repeated(const int n, const string_view &s) -> string
auto is_whitespace(const Char ch) -> Truth
CPPX_USE_STD(basic_string, basic_string_view, bitset, char_traits, size)
auto right(const string_view &s, const int width) -> string
auto trimmed(const string_view &sv) -> string_view
auto p_first_of(const basic_string_view< Char > &view) noexcept -> C_str_< Char >
constexpr auto & left_quote_str
Simple type builders Type_, P_, R_, Raw_array_ and Raw_array_of_.
auto is_empty(const Collection &c) -> Truth
auto next(P_< const char > p) -> P_< const char >
auto spaces(const int n) -> string
auto quoted(const string_view &sv) -> string
auto joined(const Span_< Iterator > range, const string &separator=" ") -> string
constexpr auto & right_quote_str
auto p_beyond_of(const basic_string_view< Char > &view) noexcept -> C_str_< Char >