clipp::str Namespace Reference

string matching and processing tools More...

Functions

template<class T >
make (const arg_string &s)
 converts string to value of target type 'T' More...
 
template<class C , class T , class A >
void trimr (std::basic_string< C, T, A > &s)
 removes trailing whitespace from string More...
 
template<class C , class T , class A >
void triml (std::basic_string< C, T, A > &s)
 removes leading whitespace from string More...
 
template<class C , class T , class A >
void trim (std::basic_string< C, T, A > &s)
 removes leading and trailing whitespace from string More...
 
template<class C , class T , class A >
void remove_ws (std::basic_string< C, T, A > &s)
 removes all whitespaces from string More...
 
template<class C , class T , class A >
bool has_prefix (const std::basic_string< C, T, A > &subject, const std::basic_string< C, T, A > &prefix)
 returns true, if the 'prefix' argument is a prefix of the 'subject' argument More...
 
template<class C , class T , class A >
bool has_postfix (const std::basic_string< C, T, A > &subject, const std::basic_string< C, T, A > &postfix)
 returns true, if the 'postfix' argument is a postfix of the 'subject' argument More...
 
template<class InputRange >
auto longest_common_prefix (const InputRange &strs) -> typename std::decay< decltype(*begin(strs))>::type
 returns longest common prefix of several sequential random access containers More...
 
template<class C , class T , class A , class InputRange >
subrange longest_substring_match (const std::basic_string< C, T, A > &arg, const InputRange &substrings)
 returns longest substring range that could be found in 'arg' More...
 
template<class C , class T , class A , class InputRange >
subrange longest_prefix_match (const std::basic_string< C, T, A > &arg, const InputRange &prefixes)
 returns longest prefix range that could be found in 'arg' More...
 
template<class C , class T , class A >
subrange substring_match (const std::basic_string< C, T, A > &subject, const std::basic_string< C, T, A > &query)
 returns the first occurrence of 'query' within 'subject' More...
 
template<class C , class T , class A >
subrange first_number_match (std::basic_string< C, T, A > s, C digitSeparator=C(','), C decimalPoint=C('.'), C exponential=C('e'))
 returns first substring match (pos,len) within the input string that represents a number (with at maximum one decimal point and digit separators) More...
 
template<class C , class T , class A >
subrange first_integer_match (std::basic_string< C, T, A > s, C digitSeparator=C(','))
 returns first substring match (pos,len) that represents an integer (with optional digit separators) More...
 
template<class C , class T , class A >
bool represents_number (const std::basic_string< C, T, A > &candidate, C digitSeparator=C(','), C decimalPoint=C('.'), C exponential=C('e'))
 returns true if candidate string represents a number More...
 
template<class C , class T , class A >
bool represents_integer (const std::basic_string< C, T, A > &candidate, C digitSeparator=C(','))
 returns true if candidate string represents an integer More...
 

Detailed Description

string matching and processing tools

Function Documentation

◆ first_integer_match()

template<class C , class T , class A >
subrange clipp::str::first_integer_match ( std::basic_string< C, T, A >  s,
digitSeparator = C(',') 
)

returns first substring match (pos,len) that represents an integer (with optional digit separators)

Definition at line 977 of file clipp.h.

◆ first_number_match()

template<class C , class T , class A >
subrange clipp::str::first_number_match ( std::basic_string< C, T, A >  s,
digitSeparator = C(','),
decimalPoint = C('.'),
exponential = C('e') 
)

returns first substring match (pos,len) within the input string that represents a number (with at maximum one decimal point and digit separators)

Definition at line 917 of file clipp.h.

◆ has_postfix()

template<class C , class T , class A >
bool clipp::str::has_postfix ( const std::basic_string< C, T, A > &  subject,
const std::basic_string< C, T, A > &  postfix 
)
inline

returns true, if the 'postfix' argument is a postfix of the 'subject' argument

Definition at line 760 of file clipp.h.

◆ has_prefix()

template<class C , class T , class A >
bool clipp::str::has_prefix ( const std::basic_string< C, T, A > &  subject,
const std::basic_string< C, T, A > &  prefix 
)
inline

returns true, if the 'prefix' argument is a prefix of the 'subject' argument

Definition at line 744 of file clipp.h.

◆ longest_common_prefix()

template<class InputRange >
auto clipp::str::longest_common_prefix ( const InputRange &  strs) -> typename std::decay<decltype(*begin(strs))>::type

returns longest common prefix of several sequential random access containers

InputRange require begin and end (member functions or overloads) the elements of InputRange require a size() member

Definition at line 780 of file clipp.h.

◆ longest_prefix_match()

template<class C , class T , class A , class InputRange >
subrange clipp::str::longest_prefix_match ( const std::basic_string< C, T, A > &  arg,
const InputRange &  prefixes 
)

returns longest prefix range that could be found in 'arg'

Parameters
argstring to be searched in
prefixesrange of candidate prefix strings

Definition at line 863 of file clipp.h.

◆ longest_substring_match()

template<class C , class T , class A , class InputRange >
subrange clipp::str::longest_substring_match ( const std::basic_string< C, T, A > &  arg,
const InputRange &  substrings 
)

returns longest substring range that could be found in 'arg'

Parameters
argstring to be searched in
substringsrange of candidate substrings

Definition at line 827 of file clipp.h.

◆ make()

template<class T >
T clipp::str::make ( const arg_string s)

converts string to value of target type 'T'

Definition at line 661 of file clipp.h.

◆ remove_ws()

template<class C , class T , class A >
void clipp::str::remove_ws ( std::basic_string< C, T, A > &  s)
inline

removes all whitespaces from string

Definition at line 726 of file clipp.h.

◆ represents_integer()

template<class C , class T , class A >
bool clipp::str::represents_integer ( const std::basic_string< C, T, A > &  candidate,
digitSeparator = C(',') 
)

returns true if candidate string represents an integer

Definition at line 1033 of file clipp.h.

◆ represents_number()

template<class C , class T , class A >
bool clipp::str::represents_number ( const std::basic_string< C, T, A > &  candidate,
digitSeparator = C(','),
decimalPoint = C('.'),
exponential = C('e') 
)

returns true if candidate string represents a number

Definition at line 1014 of file clipp.h.

◆ substring_match()

template<class C , class T , class A >
subrange clipp::str::substring_match ( const std::basic_string< C, T, A > &  subject,
const std::basic_string< C, T, A > &  query 
)
inline

returns the first occurrence of 'query' within 'subject'

Definition at line 897 of file clipp.h.

◆ trim()

template<class C , class T , class A >
void clipp::str::trim ( std::basic_string< C, T, A > &  s)
inline

removes leading and trailing whitespace from string

Definition at line 712 of file clipp.h.

◆ triml()

template<class C , class T , class A >
void clipp::str::triml ( std::basic_string< C, T, A > &  s)
inline

removes leading whitespace from string

Definition at line 693 of file clipp.h.

◆ trimr()

template<class C , class T , class A >
void clipp::str::trimr ( std::basic_string< C, T, A > &  s)
inline

removes trailing whitespace from string

Definition at line 675 of file clipp.h.