8#if !defined(ALIB_C20_MODULES) || ((ALIB_C20_MODULES != 0) && (ALIB_C20_MODULES != 1))
9# error "Symbol ALIB_C20_MODULES has to be given to the compiler as either 0 or 1"
18 module ALib.Characters.Functions;
38template<
typename TChar>
40 TChar* start= &array[0];
41 TChar* end = &array[length-1];
42 while( start < end ) {
50template<
typename TChar>
52 const TChar* needles,
integer needlesLength ) {
54 if ( needlesLength == -1 ) needlesLength=
integer(
Length( needles ) );
56 const TChar* end= haystack + length;
58 const TChar* s= haystack;
60 for(
integer i= 0; i < needlesLength ; ++i )
61 if( *(needles + i) == *s )
69template<
typename TChar>
71 const TChar* needles,
integer needlesLength ) {
73 if ( needlesLength == -1 ) needlesLength=
integer(
Length( needles ) );
75 const TChar* end= haystack + length;
76 const TChar* s = haystack - 1;
79 for( i= 0; i < needlesLength ; ++i )
80 if( needles[i] == *s )
82 if ( i == needlesLength )
89template<
typename TChar>
91 const TChar* needles,
integer needlesLength ) {
92 if ( needlesLength == -1 ) needlesLength=
integer(
Length( needles ) );
94 const TChar* s= haystack + startPos;
95 while( s >= haystack ) {
97 for(
integer i= 0; i < needlesLength ; ++i )
98 if( *(needles + i) == *s )
106template<typename TChar>
108 const TChar* needles,
integer needlesLength ) {
109 if ( needlesLength == -1 ) needlesLength=
integer(
Length( needles ) );
111 const TChar* s= haystack + startPos;
112 while( s >= haystack ) {
116 for( i= 0; i < needlesLength ; ++i )
117 if( needles[i] == *s )
119 if ( i == needlesLength )
127template<
typename TChar>
129 const TChar* needle,
integer needleLength,
131 if ( haystackLength == -1 ) haystackLength=
integer(
Length( haystack ) );
132 if ( needleLength == -1 ) needleLength=
integer(
Length( needle ) );
137 while( idx != haystackLength
138 && idx != needleLength
139 && haystack[idx] == needle[idx] )
142 while( idx != haystackLength
143 && idx != needleLength
166#if !ALIB_CHARACTERS_NATIVE_WCHAR
169 wchar* end= dest + length;
176 const wchar* end= str1 + cmpLength;
179 if( ( diff=
int( towupper(wint_t(*str1++)))
180 -
int( towupper(wint_t(*str2++))) ) != 0 )
187 const wchar* h= haystack;
190 const wchar* n= needles;
204 const wchar* h= haystack;
207 const wchar* n= needles;
240#if ALIB_CHARACTERS_NATIVE_WCHAR
242 xchar* end= dest + length;
248 const xchar* end= str1 + cmpLength;
251 if( ( diff=
int( towupper(wint_t(*str1++)))
252 -
int( towupper(wint_t(*str2++))) ) != 0 )
258 const xchar* h= haystack;
260 const xchar* n= needles;
272 const xchar* h= haystack;
274 const xchar* n= needles;
#define ALIB_ASSERT_ERROR(cond, domain,...)
integer Length(const TChar *cstring)
integer IndexOfFirstDifference(const TChar *haystack, integer haystackLength, const TChar *needle, integer needleLength, lang::Case sensitivity)
integer LastIndexOfAnyExclude(const TChar *haystack, integer startIdx, const TChar *needles, integer needlesLength)
void Reverse(TChar *src, integer length)
integer LastIndexOfAnyInclude(const TChar *haystack, integer startIdx, const TChar *needles, integer needlesLength)
integer IndexOfAnyIncludedZT(const TChar *haystack, const TChar *needles)
integer IndexOfAnyIncluded(const TChar *haystack, integer haystackLength, const TChar *needles, integer needlesLength)
integer IndexOfAnyExcluded(const TChar *haystack, integer haystackLength, const TChar *needles, integer needlesLength)
integer IndexOfAnyExcludedZT(const TChar *haystack, const TChar *needles)
int CompareIgnoreCase(const TChar *lhs, const TChar *rhs, integer cmpLength)
Case
Denotes upper and lower case character treatment.
lang::integer integer
Type alias in namespace alib.
strings::TFill< character > Fill
Type alias in namespace alib.