37template<
typename TChar>
84 whiteSpaces.Length() );
105 whiteSpaces.Buffer(),
106 whiteSpaces.Length() ) + 1;
133 template <
typename TCheck =
CHK,
137 if constexpr ( TCheck::value )
218 template <
typename TCheck=
CHK,
225 if constexpr ( TCheck::value )
253 template <
typename TCheck= CHK>
256 if constexpr ( TCheck::value )
258 if ( regionLength < 0 )
260 if ( target !=
nullptr )
270 "Non checking and index out of range: 0 <= {} <= {}.", regionLength,
base::length )
274 if ( target !=
nullptr )
275 *target= this->base::template
Substring<NC>( 0, regionLength );
297 template <
typename TCheck= CHK>
300 if constexpr ( TCheck::value )
302 if ( regionLength < 0 )
304 if ( target !=
nullptr )
314 "Non checking and index out of range: 0 <= {} <= {}.", regionLength,
base::length )
317 if ( target !=
nullptr )
348 template <
typename TCheck =
CHK,
350 typename TAllocator >
358 if constexpr ( TCheck::value )
360 if ( separatorWidth < 0 )
363 if ( regionLength < 0 )
369 if ( regionLength < 0 )
377 "Non checking but separator width negative: ", separatorWidth )
379 && regionLength + separatorWidth <=
base::length,
"STRINGS",
380 "Non checking but regionLength out of bounds: 0 <= {}, {} <= {}.",
381 regionLength, regionLength + separatorWidth,
base::length )
384 target.template _<NC>( *
this, 0, regionLength );
386 regionLength+= separatorWidth;
413 template <
typename TCheck = CHK>
418 if constexpr ( TCheck::value )
420 if ( separatorWidth < 0 )
423 if ( regionLength < 0 )
429 if ( regionLength < 0 )
436 "STRINGS",
"Non checking but separator width negative" )
438 && regionLength + separatorWidth <=
base::length,
"STRINGS",
439 "Non checking but regionLength out of bounds: 0 <= {}, {} <= {}.",
440 regionLength, regionLength + separatorWidth,
base::length )
445 regionLength+= separatorWidth;
474 template <
typename TCheck =
CHK,
476 typename TAllocator >
484 if constexpr ( TCheck::value )
486 if ( separatorWidth < 0 ) separatorWidth= 0;
494 "STRINGS",
"Non checking but separator width negative" )
496 "STRINGS",
"Non checking but regionLength out of bounds: 0 <= {}, {} <= {}.",
497 regionLength, regionLength + separatorWidth,
base::length )
500 target.template _<NC>( *
this,
base::length - regionLength, regionLength );
609 minChars= int( consumable.
Length() );
611 if ( minChars == 0 || minChars > consumable.
Length() )
615 if( diff <
integer( minChars ) )
632 template< lang::Whitespaces TTrimBeforeConsume= lang::Whitespaces::Keep >
663 result=
static_cast<std::remove_reference_t<decltype(result)
>>(resultImpl);
686 result=
static_cast<std::remove_reference_t<decltype(result)
>>( resultImpl );
711 result=
static_cast<std::remove_reference_t<decltype(result)
>>( resultImpl );
731 result=
static_cast<std::remove_reference_t<decltype(result)
>>( resultImpl );
753 result=
static_cast<std::remove_reference_t<decltype(result)
>>( resultImpl );
775 result=
static_cast<std::remove_reference_t<decltype(result)
>>( resultImpl );
817 template <
typename TCheck= CHK>
822 if constexpr ( TCheck::value )
827 "Non checking but position out of bounds: 0 <= {} < {}.", position,
base::length )
829 "Non checking but position + separator width out of bounds: {} <= {}.",
833 target= this->base::template
Substring<NC>( position + separatorWidth,
917template<
typename TChar>
struct ArrayTraits<
strings::TSubstring<TChar>, TChar>
922 static constexpr const TChar*
Buffer (
const T& src) {
return src.
Buffer(); }
923 static constexpr integer Length (
const T& src) {
return src.Length(); }
967template<
typename TChar>
968bool operator== (
const TSubstring<TChar>& lhs,
const TSubstring<TChar>& rhs)
969{
return lhs.
template Equals <CHK, lang::Case::Sensitive>(rhs); }
972template<
typename TChar,
typename T>
973requires (!std::is_same_v<T, TSubstring<TChar>>)
974bool operator== (
const TSubstring<TChar>& lhs,
const T& rhs)
975{
return lhs.
template Equals <CHK, lang::Case::Sensitive>(rhs); }
978template<
typename TChar>
979auto operator<=> (
const TSubstring<TChar>& lhs,
const TSubstring<TChar>& rhs)
980{
return lhs.
template CompareTo<CHK, lang::Case::Sensitive>(rhs); }
983template<
typename TChar,
typename T>
984requires (!std::same_as<TSubstring<TChar>, T>)
985auto operator<=> (
const TSubstring<TChar>& lhs,
const T& rhs)
986{
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".