57bool G::format::isdigit(
char c )
noexcept
60 return c >=
'0' && c <=
'9' ;
65 std::string s = m_fmt ;
66 const std::size_t npos = std::string::npos ;
67 for( std::size_t p = s.find(
'%') ; p != npos && (p+2U) < s.size() ; )
69 std::size_t q = s.find(
'%' , p+1 ) ;
70 if( q != npos && q == (p+2U) && isdigit(s.at(p+1U)) )
73 if( n && n <= m_values.size() )
75 s.replace( p , 3U , m_values.at(n-1U) ) ;
76 p += m_values.at(n-1U).size() ;
87 p = p < s.size() ? s.find(
'%',p) : npos ;
99void G::format::apply(
const std::string & value )
101 m_values.push_back( value ) ;
104std::ostream & G::operator<<( std::ostream & stream ,
const format & f )
106 return stream << f.str() ;
static unsigned int toUInt(std::string_view s)
Converts string 's' to an unsigned int.