ALib C++ Framework
by
Library Version: 2605 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
tokenizer.cpp
1namespace alib { namespace strings { namespace util {
2
3template<typename TChar>
5 if ( Rest.IsNull() ) {
6 Actual= nullptr;
7 return Actual;
8 }
9
10 // change of delim?
11 if ( newDelim != '\0' )
12 delim= newDelim;
13
14 do
15 {
16 integer nextDelimiter= Rest.IndexOf( delim );
17
18 if ( nextDelimiter >= 0 ) {
19 Actual= Rest.template Substring<NC>( 0 , nextDelimiter );
20 Rest = Rest.template Substring<NC>( nextDelimiter + 1, Rest.Length() - (nextDelimiter + 1) );
21 } else {
22 Actual= Rest;
23 Rest = nullptr;
24 }
25
26 // trim
27 if ( trimming == lang::Whitespaces::Trim )
28 Actual.Trim( TrimChars );
29 }
30 while( skipEmpty && Actual.IsEmpty() && Rest.IsNotNull() );
31
32 return Actual;
33}
34
37
38}}} // namespace [alib::strings::util]
TChar delim
The most recently set delimiter used by default for the next token extraction.
Definition tokenizer.hpp:76
TSubstring< TChar > Actual
Definition tokenizer.hpp:64
TSubstring< TChar > & Next(lang::Whitespaces trimming=lang::Whitespaces::Trim, TChar newDelim='\0')
Definition tokenizer.cpp:4
bool skipEmpty
If true, empty tokens are omitted.
Definition tokenizer.hpp:79
TLocalString< TChar, 8 > TrimChars
Definition tokenizer.hpp:68
Whitespaces
Denotes whether a string is trimmed or not.
@ Trim
Trim whitespaces away.
Definition alox.cpp:14
characters::wchar wchar
Type alias in namespace #"%alib".
lang::integer integer
Type alias in namespace #"%alib".
Definition integers.hpp:149
strings::TSubstring< character > Substring
Type alias in namespace #"%alib".
characters::nchar nchar
Type alias in namespace #"%alib".