37template<
typename TChar>
76 whiteSpaces.Length() );
96 whiteSpaces.Length() ) + 1;
122 template <
typename TCheck =
CHK,
125 if constexpr ( TCheck::value ) {
200 template <
typename TCheck=
CHK,
206 if constexpr ( TCheck::value ) {
231 template <
typename TCheck= CHK>
233 if constexpr ( TCheck::value ) {
234 if ( regionLength < 0 ) {
235 if ( target !=
nullptr )
243 "Non checking and index out of range: 0 <= {} <= {}.", regionLength,
base::length )
247 if ( target !=
nullptr )
248 *target= this->base::template
Substring<NC>( 0, regionLength );
270 template <
typename TCheck= CHK>
272 if constexpr ( TCheck::value ) {
273 if ( regionLength < 0 ) {
274 if ( target !=
nullptr )
282 "Non checking and index out of range: 0 <= {} <= {}.", regionLength,
base::length )
285 if ( target !=
nullptr )
316 template <
typename TCheck =
CHK,
318 typename TAllocator >
325 if constexpr ( TCheck::value ) {
326 if ( separatorWidth < 0 )
329 if ( regionLength < 0 )
334 if ( regionLength < 0 )
340 "Non checking but separator width negative: ", separatorWidth )
342 && regionLength + separatorWidth <=
base::length,
"STRINGS",
343 "Non checking but regionLength out of bounds: 0 <= {}, {} <= {}.",
344 regionLength, regionLength + separatorWidth,
base::length )
347 target.template _<NC>( *
this, 0, regionLength );
349 regionLength+= separatorWidth;
376 template <
typename TCheck = CHK>
380 if constexpr ( TCheck::value ) {
381 if ( separatorWidth < 0 )
384 if ( regionLength < 0 )
389 if ( regionLength < 0 )
394 "STRINGS",
"Non checking but separator width negative" )
396 && regionLength + separatorWidth <=
base::length,
"STRINGS",
397 "Non checking but regionLength out of bounds: 0 <= {}, {} <= {}.",
398 regionLength, regionLength + separatorWidth,
base::length )
403 regionLength+= separatorWidth;
432 template <
typename TCheck =
CHK,
434 typename TAllocator >
441 if constexpr ( TCheck::value ) {
442 if ( separatorWidth < 0 ) separatorWidth= 0;
448 "STRINGS",
"Non checking but separator width negative" )
450 "STRINGS",
"Non checking but regionLength out of bounds: 0 <= {}, {} <= {}.",
451 regionLength, regionLength + separatorWidth,
base::length )
454 target.template _<NC>( *
this,
base::length - regionLength, regionLength );
559 minChars= int( consumable.
Length() );
561 if ( minChars == 0 || minChars > consumable.
Length() )
565 if( diff <
integer( minChars ) )
582 template< lang::Whitespaces TTrimBeforeConsume= lang::Whitespaces::Keep >
611 result=
static_cast<std::remove_reference_t<decltype(result)
>>(resultImpl);
633 result=
static_cast<std::remove_reference_t<decltype(result)
>>( resultImpl );
657 result=
static_cast<std::remove_reference_t<decltype(result)
>>( resultImpl );
676 result=
static_cast<std::remove_reference_t<decltype(result)
>>( resultImpl );
697 result=
static_cast<std::remove_reference_t<decltype(result)
>>( resultImpl );
718 result=
static_cast<std::remove_reference_t<decltype(result)
>>( resultImpl );
760 template <
typename TCheck= CHK>
763 if constexpr ( TCheck::value )
767 "Non checking but position out of bounds: 0 <= {} < {}.", position,
base::length )
769 "Non checking but position + separator width out of bounds: {} <= {}.",
773 target= this->base::template
Substring<NC>( position + separatorWidth,
856template<
typename TChar>
struct ArrayTraits<
strings::TSubstring<TChar>, TChar>
861 static constexpr const TChar*
Buffer (
const T& src) {
return src.
Buffer(); }
862 static constexpr integer Length (
const T& src) {
return src.Length(); }
906template<
typename TChar>
907bool operator== (
const TSubstring<TChar>& lhs,
const TSubstring<TChar>& rhs)
908{
return lhs.
template Equals <CHK, lang::Case::Sensitive>(rhs); }
911template<
typename TChar,
typename T>
912requires (!std::is_same_v<T, TSubstring<TChar>>)
913bool operator== (
const TSubstring<TChar>& lhs,
const T& rhs)
914{
return lhs.
template Equals <CHK, lang::Case::Sensitive>(rhs); }
917template<
typename TChar>
918auto operator<=> (
const TSubstring<TChar>& lhs,
const TSubstring<TChar>& rhs)
919{
return lhs.
template CompareTo<CHK, lang::Case::Sensitive>(rhs); }
922template<
typename TChar,
typename T>
923requires (!std::same_as<TSubstring<TChar>, T>)
924auto operator<=> (
const TSubstring<TChar>& lhs,
const T& rhs)
925{
return lhs.
template CompareTo<CHK, lang::Case::Sensitive>(rhs); }
constexpr integer Length() const
constexpr bool IsEmpty() const
bool EndsWith(const TString &needle) const
character CharAtStart() const
constexpr bool IsNotNull() const
integer IndexOfFirstDifference(const TString &needle, lang::Case sensitivity=lang::Case::Sensitive, integer startIdx=0) const
bool AdjustRegion(integer ®ionStart, integer ®ionLength) const
constexpr const TChar * Buffer() const
character CharAtEnd() const
constexpr TString() noexcept=default
integer IndexOfSegmentEnd(character opener, character closer, integer idx) const
bool StartsWith(const TString &needle) const
integer IndexOfOrLength(TChar needle) const
TString< TChar > ConsumeField(TChar startChar, TChar endChar)
TChar ConsumeCharFromEnd()
bool ConsumeString(const TString< TChar > &consumable)
TSubstring & TrimStart(const TCString< TChar > &whiteSpaces=CStringConstantsTraits< TChar >::DefaultWhitespaces())
TSubstring & Split(integer position, TSubstring &target, integer separatorWidth=0, bool trim=false)
ALIB_DLL bool ConsumeFloat(double &result, TNumberFormat< TChar > *numberFormat=nullptr)
integer ConsumeChars(integer regionLength, TAString< TChar, TAllocator > &target, integer separatorWidth=0)
ALIB_DLL bool consumeHexImpl(uint64_t &result, TNumberFormat< TChar > *numberFormat)
bool ConsumeBin(std::integral auto &result, TNumberFormat< TChar > *numberFormat=nullptr)
bool ConsumeOct(std::integral auto &result, TNumberFormat< TChar > *numberFormat=nullptr)
ALIB_DLL bool consumeDecDigitsImpl(uint64_t &result)
integer ConsumePartOf(const TString< TChar > &consumable, int minChars=1)
bool ConsumeDecDigits(std::integral auto &result)
bool ConsumeCharFromEnd(TChar consumable)
integer ConsumeChars(integer regionLength, TString< TChar > &target, integer separatorWidth=0)
TSubstring(const TString< TChar > &src)
ALIB_DLL bool consumeDecImpl(uint64_t &result, TNumberFormat< TChar > *numberFormat)
TString< TChar > base
The base string-type.
bool ConsumeInt(std::integral auto &result, TNumberFormat< TChar > *numberFormat=nullptr)
ALIB_DLL bool consumeBinImpl(uint64_t &result, TNumberFormat< TChar > *numberFormat)
bool ConsumeDec(std::integral auto &result, TNumberFormat< TChar > *numberFormat=nullptr)
integer ConsumeChars(integer regionLength, TSubstring *target=nullptr)
bool ConsumeStringFromEnd(const TString< TChar > &consumable)
TSubstring & Trim(const TCString< TChar > &whiteSpaces=CStringConstantsTraits< TChar >::DefaultWhitespaces())
bool ConsumeHex(std::integral auto &result, TNumberFormat< TChar > *numberFormat=nullptr)
integer ConsumeCharsFromEnd(integer regionLength, TSubstring *target=nullptr)
bool ConsumeChar(TChar consumable)
ALIB_DLL bool consumeOctImpl(uint64_t &result, TNumberFormat< TChar > *numberFormat)
integer ConsumeCharsFromEnd(integer regionLength, TAString< TChar, TAllocator > &target, integer separatorWidth=0)
TString< TChar > ConsumeToken(TChar separator=',', lang::Inclusion includeSeparator=lang::Inclusion::Include)
TSubstring & TrimEnd(const TCString< TChar > &whiteSpaces=CStringConstantsTraits< TChar >::DefaultWhitespaces())
ALIB_DLL bool consumeIntImpl(int64_t &result, TNumberFormat< TChar > *numberFormat)
TSubstring()
Default constructor creating a 6.1 Nulled Strings "nulled" substring.
#define ALIB_ASSERT_ERROR(cond, domain,...)
integer LastIndexOfAnyExclude(const TChar *haystack, integer startIdx, const TChar *needles, integer needlesLength)
integer IndexOfAnyExcluded(const TChar *haystack, integer haystackLength, const TChar *needles, integer needlesLength)
Case
Denotes upper and lower case character treatment.
@ Clear
Chooses to clear existing data.
Whitespaces
Denotes whether a string is trimmed or not.
@ Keep
Keep whitespaces in string.
@ Trim
Trim whitespaces away.
Inclusion
Denotes how members of a set something should be taken into account.
@ Include
Chooses inclusion.
strings::TSubstring< xchar > XSubstring
Type alias in namespace alib.
strings::TSubstring< nchar > NSubstring
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
strings::TSubstring< complementChar > ComplementSubstring
Type alias in namespace alib.
strings::TSubstring< wchar > WSubstring
Type alias in namespace alib.
strings::TSubstring< character > Substring
Type alias in namespace alib.
strings::TSubstring< strangeChar > StrangeSubstring
Type alias in namespace alib.
static constexpr Policy Access
static integer Length(const TStringSource &src)
static TStringSource Construct(const TChar *array, integer length)
static constexpr Policy Construction
static const TChar * Buffer(const TStringSource &src)
static constexpr CString< TChar > DefaultWhitespaces())
"carriage return" and "tabulator", hence " \n\r\t".