30 #ifndef __CLAW_STRING_ALGORITHM_HPP__
31 #define __CLAW_STRING_ALGORITHM_HPP__
39 template<
typename StreamType,
typename StringType>
40 StreamType&
getline( StreamType& is, StringType& str );
42 template<
typename StringType>
44 const typename StringType::value_type*
const s =
" " );
46 template<
typename StringType>
48 const typename StringType::value_type*
const s =
" " );
50 template<
typename StringType>
51 void trim( StringType& str,
52 const typename StringType::value_type*
const s =
" " );
54 template<
typename StringType>
56 const typename StringType::value_type*
const s );
58 template<
typename StringType>
60 replace( StringType& str,
const StringType& e1,
const StringType& e2 );
62 template<
typename T,
typename StringType>
65 template<
typename Sequence>
67 ( Sequence& sequence,
const typename Sequence::value_type& str,
68 const typename Sequence::value_type::value_type sep );
70 template<
typename Sequence>
72 ( Sequence& sequence,
typename Sequence::value_type::const_iterator first,
73 typename Sequence::value_type::const_iterator last,
74 const typename Sequence::value_type::value_type sep );
76 template<
typename InputIterator,
typename OutputIterator>
78 ( InputIterator first, InputIterator last, OutputIterator out );
80 template<
typename StringType>
81 bool glob_match(
const StringType& pattern,
const StringType& text,
82 const typename StringType::value_type any_sequence =
'*',
83 const typename StringType::value_type zero_or_one =
'?',
84 const typename StringType::value_type any =
'.' );
86 template<
typename StringType>
88 (
const StringType& pattern,
const StringType& text,
89 const typename StringType::value_type any_sequence =
'*',
90 const typename StringType::value_type zero_or_one =
'?',
91 const typename StringType::value_type any =
'.' );
98 #endif // __CLAW_STRING_ALGORITHM_HPP__
bool glob_match(const StringType &pattern, const StringType &text, const typename StringType::value_type any_sequence= '*', const typename StringType::value_type zero_or_one= '?', const typename StringType::value_type any= '.')
Check if a string matches a given pattern.
void c_escape(InputIterator first, InputIterator last, OutputIterator out)
Find escaped symbols in a sequence of characters and replace them by their c-equivalent.
void split(Sequence &sequence, const typename Sequence::value_type &str, const typename Sequence::value_type::value_type sep)
Split a string into several substrings, according to a given separator.
void squeeze(StringType &str, const typename StringType::value_type *const s)
Squeeze successive characters of a string into one character.
std::size_t replace(StringType &str, const StringType &e1, const StringType &e2)
Replace a set of characters by other characters.
StreamType & getline(StreamType &is, StringType &str)
A portable version of std::getline( is, str, '\n' ) that removes a tailing '\r'.
void trim(StringType &str, const typename StringType::value_type *const s=" ")
Remove characters at the begining end at the end of a string.
void trim_right(StringType &str, const typename StringType::value_type *const s=" ")
Remove characters at the end of a string.
bool is_of_type(const StringType &str)
Test if the content of a string is immediately convertible to a type.
void trim_left(StringType &str, const typename StringType::value_type *const s=" ")
Remove characters at the begining of a string.
bool glob_potential_match(const StringType &pattern, const StringType &text, const typename StringType::value_type any_sequence= '*', const typename StringType::value_type zero_or_one= '?', const typename StringType::value_type any= '.')
Check if a string may match a given pattern.
Implementation of the globalization algorithms.