203 using inherited = Iterable<Character>;
242 template <IUNICODECanUnambiguouslyConvertFrom CHAR_T>
243 String (
const CHAR_T* cString);
244 template <Memory::ISpan SPAN_OF_CHAR_T>
247 template <IStdBasicStringCompatibleCharacter CHAR_T>
248 String (
const basic_string<CHAR_T>& s);
249 template <IStdBasicStringCompatibleCharacter CHAR_T>
250 String (
const basic_string_view<CHAR_T>& s);
251 template <IStdBasicStringCompatibleCharacter CHAR_T>
252 explicit String (basic_string<CHAR_T>&& s);
253 template <IUNICODECanUnambiguouslyConvertFrom CHAR_T>
254 String (
const Iterable<CHAR_T>& src)
256 template <IStdPathLike2UNICODEString PATHLIKE_TOSTRINGABLE>
257 explicit String (PATHLIKE_TOSTRINGABLE&& s);
262 template <IStdPathLike2UNICODEString PATHLIKE_TOSTRINGABLE>
263 static String mkSTR_ (PATHLIKE_TOSTRINGABLE&& s);
266 static shared_ptr<_IRep> CTORFromBasicStringView_ (
const basic_string_view<ASCII>& str);
267 static shared_ptr<_IRep> CTORFromBasicStringView_ (
const basic_string_view<char8_t>& str);
268 static shared_ptr<_IRep> CTORFromBasicStringView_ (
const basic_string_view<char16_t>& str);
269 static shared_ptr<_IRep> CTORFromBasicStringView_ (
const basic_string_view<char32_t>& str);
270 static shared_ptr<_IRep> CTORFromBasicStringView_ (
const basic_string_view<wchar_t>& str);
278 using _SafeReadRepAccessor = Iterable<Character>::_SafeReadRepAccessor<
_IRep>;
285 String (
const shared_ptr<_IRep>& rep)
noexcept;
286 String (shared_ptr<_IRep>&& rep)
noexcept;
289 nonvirtual
String& operator= (
String&& rhs)
noexcept =
default;
290 nonvirtual
String& operator= (
const String& rhs)
noexcept =
default;
306 template <
typename CHAR_T>
308 requires (same_as<remove_cv_t<CHAR_T>,
char8_t> or same_as<remove_cv_t<CHAR_T>,
char>);
309 template <
typename CHAR_T>
311 requires (same_as<remove_cv_t<CHAR_T>,
char8_t> or same_as<remove_cv_t<CHAR_T>,
char>);
312 template <
typename CHAR_T>
314 requires (same_as<remove_cv_t<CHAR_T>,
char8_t> or same_as<remove_cv_t<CHAR_T>,
char>);
383 template <
size_t SIZE, IUNICODECanUnambiguouslyConvertFrom CHAR_T>
385 template <IUNICODECanUnambiguouslyConvertFrom CHAR_T>
387 template <IUNICODECanUnambiguouslyConvertFrom CHAR_T>
406 template <IUNICODECanUnambiguouslyConvertFrom CHAR_T>
408 template <IUNICODECanUnambiguouslyConvertFrom CHAR_T>
410 template <IStdBasicStringCompatibleCharacter CHAR_T>
419 template <
typename T>
421 requires (is_convertible_v<T, String>);
424 nonvirtual
String Concatenate_ (
const String& rhs)
const;
434 nonvirtual
size_t size () const noexcept;
439 nonvirtual
bool empty () const noexcept;
444 nonvirtual const
Character GetCharAt (
size_t i) const noexcept;
454 nonvirtual const
Character operator[] (
size_t i) const noexcept;
581 template <typename SZ>
583 template <typename SZ1, typename SZ2>
597 template <typename SZ>
599 template <typename SZ1, typename SZ2>
627 nonvirtual
bool Contains (const
String& subString, CompareOptions co = eWithCase) const;
633 nonvirtual
bool ContainsAny (
Iterable<
Character> cs, CompareOptions co = eWithCase) const;
649 nonvirtual
bool StartsWith (const
String& subString, CompareOptions co = eWithCase) const;
664 nonvirtual
bool EndsWith (const
Character& c, CompareOptions co = eWithCase) const;
665 nonvirtual
bool EndsWith (const
String& subString, CompareOptions co = eWithCase) const;
741 template <Common::IAnyOf<optional<
String>*,
String*, nullptr_t>... OPTIONAL_STRINGS>
778 nonvirtual optional<
size_t>
Find (
Character c, CompareOptions co = eWithCase) const;
779 nonvirtual optional<
size_t>
Find (
Character c,
size_t startAt, CompareOptions co = eWithCase) const;
780 nonvirtual optional<
size_t>
Find (const
String& subString, CompareOptions co = eWithCase) const;
781 nonvirtual optional<
size_t>
Find (const
String& subString,
size_t startAt, CompareOptions co = eWithCase) const;
782 nonvirtual optional<pair<
size_t,
size_t>>
Find (const
RegularExpression& regEx,
size_t startAt = 0) const;
809 nonvirtual Containers::Sequence<
size_t>
FindEach (const
String& string2SearchFor, CompareOptions co = eWithCase) const;
853 nonvirtual optional<
size_t>
RFind (const
String& subString) const;
990 nonvirtual Containers::Sequence<
String>
Grep (const
String& fgrepArg) const;
1005 nonvirtual optional<
String>
Col (
size_t i) const;
1061 static String Join (
const Iterable<String>& list,
const String& separator =
", "sv);
1107 template <IUNICODECanAlwaysConvertTo CHAR_T>
1108 nonvirtual span<CHAR_T>
CopyTo (span<CHAR_T> s)
const
1109 requires (not is_const_v<CHAR_T>);
1138 template <
typename T>
1160 template <typename T = u8string>
1162 requires (same_as<T,
string> or same_as<T, u8string>);
1178 template <typename T = u16string>
1180 requires (same_as<T, u16string> or (sizeof (
wchar_t) == sizeof (
char16_t) and same_as<T, wstring>));
1196 template <typename T = u32string>
1198 requires (same_as<T, u32string> or (sizeof (
wchar_t) == sizeof (
char32_t) and same_as<T, wstring>));
1240 template <typename T =
string>
1242 requires requires (T* into) {
1243 { into->empty () } -> same_as<bool>;
1244 { into->push_back (
ASCII{0}) };
1258 template <
typename T =
string>
1260 requires requires (T* into) {
1261 { into->empty () } -> same_as<bool>;
1262 { into->push_back (
ASCII{0}) };
1297 span<const ASCII> fAscii;
1298 span<const Latin1> fSingleByteLatin1;
1299 span<const char16_t> fChar16;
1300 span<const char32_t> fChar32;
1318 template <IUNICODECanUnambiguouslyConvertFrom CHAR_TYPE = ASCII>
1334 template <IUNICODECanUnambiguouslyConvertFrom CHAR_TYPE>
1336 template <IUNICODECanUnambiguouslyConvertFrom CHAR_TYPE>
1337 nonvirtual optional<span<const CHAR_TYPE>>
PeekData ()
const;
1364 template <IUNICODECanAlwaysConvertTo CHAR_TYPE,
size_t STACK_BUFFER_SZ>
1366 template <IUNICODECanAlwaysConvertTo CHAR_TYPE,
size_t STACK_BUFFER_SZ>
1376 struct ThreeWayComparer;
1387 template <IConvertibleToString T>
1389 requires (not same_as<remove_cvref_t<T>,
String>);
1399 template <IConvertibleToString T>
1400 nonvirtual strong_ordering
operator<=> (T&& rhs)
const
1401 requires (not same_as<remove_cvref_t<T>,
String>);
1409 static constexpr size_t npos =
static_cast<size_t> (-1);
1415 nonvirtual
size_t length () const noexcept;
1442 nonvirtual tuple<const
wchar_t*, wstring_view> c_str (Memory::StackBuffer<
wchar_t>* possibleBackingStore) const;
1452 nonvirtual
size_t find (
Character c,
size_t startAt = 0) const;
1453 nonvirtual
size_t find (const
String& s,
size_t startAt = 0) const;
1497 [[deprecated ("Since Stroika v3.0d13 - if you must use c_str() - use the overload taking StackBuffer arg), or use
As<wstring> "
1498 "().c_str ()")]] const
wchar_t*
1500 [[deprecated ("Since Stroika v3.0d12 use
StringBuilder::SetAt")]]
void SetCharAt (
Character c,
size_t i);
1501 [[deprecated ("Since Stroika v3.0d12 use
StringBuilder")]]
void erase (
size_t from = 0);
1502 [[deprecated ("Since Stroika v3.0d12 use
StringBuilder")]]
void erase (
size_t from,
size_t count);
1503 [[deprecated ("Since Stroika v3.0d12 use
StringBuilder")]]
void push_back (
wchar_t c);
1507 [[deprecated ("Since Stroika v3.0d12 use
StringBuilder")]]
void Append (const
wchar_t* s);
1508 [[deprecated ("Since Stroika v3.0d12 use
StringBuilder")]]
void Append (const
wchar_t* from, const
wchar_t* to);
1510 template <typename CHAR_T>
1511 [[deprecated ("Since Stroika v3.0d12 use
StringBuilder")]]
void Append (span<const CHAR_T> s)
1512 requires (same_as<CHAR_T,
Character> or same_as<CHAR_T,
char32_t>);
1515 [[deprecated ("Since Stroika v3.0d12 use
StringBuilder")]]
String& operator+= (const
wchar_t* appendageCStr);
1516 [[deprecated ("Since Stroika v3.0d12 - just use a b
String{}
")]] void clear ()
1520 template <typename T>
1521 [[deprecated ("Since Stroika v3.0d2, just use 0 arg version)
")]] void As (T* into) const
1522 requires (IBasicUNICODEStdString<T> or same_as<T, String>)
1524 *into = this->As<T> ();
1526 [[deprecated ("Since Stroika v3.0d2, just use 1 arg version)
")]] void AsNarrowString (const locale& l, string* into) const
1528 *into = this->AsNarrowString (l);
1530 template <typename T = u8string>
1531 [[deprecated ("Since Stroika v3.0d2 - use
AsUTF8/0
")]] void AsUTF8 (T* into) const
1532 requires (same_as<T, string> or same_as<T, u8string>)
1534 *into = this->AsUTF8 ();
1536 template <typename T = u16string>
1537 [[deprecated ("Since Stroika v3.0d2 - use
AsUTF16/0
")]] void AsUTF16 (T* into) const
1538 requires (same_as<T, u16string> or (sizeof (wchar_t) == sizeof (char16_t) and same_as<T, wstring>))
1542 template <typename T = u32string>
1543 [[deprecated ("Since Stroika v3.0d2 - use
AsUTF32/0
")]] void AsUTF32 (T* into) const
1544 requires (same_as<T, u32string> or (sizeof (wchar_t) == sizeof (char32_t) and same_as<T, wstring>))
1548 [[deprecated ("Since Stroika v3.0d2 - just use /0
")]] void AsSDKString (SDKString* into) const
1550 *into = AsSDKString ();
1552 [[deprecated ("Since Stroika v3.0d2 - just use /0
")]] void AsNarrowSDKString (string* into) const
1554 *into = SDK2Narrow (AsSDKString ());
1556 template <typename T = string>
1557 [[deprecated ("Since v3.0d2 use /0
")]] void AsASCII (T* into) const
1558 requires (same_as<T, string> or same_as<T, Memory::StackBuffer<char>>)
1560 if (not AsASCIIQuietly (into)) {
1561 ThrowInvalidAsciiException_ ();
1564 template <typename T = string>
1565 [[deprecated ("Since v3.0d2 use /0 overload
")]] bool AsASCIIQuietly (T* into) const
1566 requires (same_as<T, string> or same_as<T, Memory::StackBuffer<char>>)
1568 auto r = this->AsASCIIQuietly ();
1577 [[deprecated ("Since Stroika v3.0d5 use
StringShorteningPreference argument
")]] String LimitLength (size_t maxLen, bool keepLeft) const
1579 return LimitLength (maxLen, keepLeft ? StringShorteningPreference::ePreferKeepLeft : StringShorteningPreference::ePreferKeepRight);
1581 [[deprecated ("Since Stroika v3.0d5 use
StringShorteningPreference argument
")]] String LimitLength (size_t maxLen, bool keepLeft,
1582 const String& ellipsis) const
1584 return LimitLength (maxLen, keepLeft ? StringShorteningPreference::ePreferKeepLeft : StringShorteningPreference::ePreferKeepRight, ellipsis);
1586 template <typename CHAR_T>
1587 [[deprecated ("Since Stroika v3.0d1,
String{}
")]] static String FromASCII (span<const CHAR_T> s)
1591 template <typename CHAR_T>
1592 [[deprecated ("Since Stroika v3.0d1,
String{}
")]] static String FromASCII (const CHAR_T* cString)
1594 return String{cString};
1596 template <IStdBasicStringCompatibleCharacter CHAR_T>
1597 [[deprecated ("Since Stroika v3.0d1,
String{}
")]] static String FromASCII (const basic_string<CHAR_T>& str)
1601 [[deprecated ("Since Stroika v3.0d1, use span{} overload
for this")]] static String FromASCII (const char* from, const char* to)
1603 return String{span{from, to}};
1605 [[deprecated ("Since Stroika v3.0d1, use span{} overload
for this")]] static String FromASCII (const wchar_t* from, const wchar_t* to)
1607 return String{span{from, to}};
1609 [[deprecated ("Since Stroika v3.0d1, use span overloads
")]] String InsertAt (const wchar_t* from, const wchar_t* to, size_t at) const
1611 Memory::StackBuffer<Character> buf{Memory::eUninitialized, UTFConvert::ComputeTargetBufferSize<Character> (span{from, to})};
1612 return InsertAt (UTFConvert::kThe.ConvertSpan (span{from, to}, span{buf}), at);
1614 [[deprecated ("Since Stroika v3.0d1, use span overloads
")]] String InsertAt (const Character* from, const Character* to, size_t at) const
1616 return InsertAt (span{from, to}, at);
1618 [[deprecated ("Since Stroika v3.0d1, use span{} overload
for this")]] static String FromLatin1 (const char* start, const char* end)
1620 return FromLatin1 (span{start, end});
1622 [[deprecated ("Since Stroika v3.0d1, use span{} constructor
for this")]] static String FromNarrowString (const char* from,
1623 const char* to, const locale& l)
1625 return FromNarrowString (span{from, to}, l);
1627 [[deprecated ("Since Stroika v3.0d1, use span{} constructor
for this")]] static String FromNarrowSDKString (const char* from, const char* to)
1629 return FromNarrowSDKString (span{from, to});
1631 template <IUNICODECanAlwaysConvertTo CHAR_T>
1632 [[deprecated ("Since Stroika v3.0d1, use span{} constructor
for this")]] String (const CHAR_T* from, const CHAR_T* to)
1633 : String{span<const CHAR_T>{from, to}}
1637 "Since Stroika v3.0d1 - use As<wstring> ().
c_str () or other
c_str() overload (*UNSAFE TO USE*)")]] nonvirtual const
wchar_t*
1638 c_str () const noexcept;
1639 [[deprecated ("Since Stroika v3.0 - use span{} overloads
")]] inline static String FromSDKString (const SDKChar* from, const SDKChar* to)
1641 return FromSDKString (span{from, to});
1643 [[deprecated ("Since Stroika v3.0 - use span{} overloads
")]] static String FromUTF8 (const char* from, const char* to)
1645 return FromUTF8 (span{from, to});
1647 [[deprecated ("Since Stroika v3.0 - use span{} overloads
")]] static String FromUTF8 (const char8_t* from, const char8_t* to)
1649 return FromUTF8 (span{from, to});
1651 template <typename T = string>
1652 [[deprecated ("Since Stroika v3.0d1 - use Character::AsAsciiQuietly
")]] static bool AsASCIIQuietly (const wchar_t* fromStart,
1653 const wchar_t* fromEnd, T* into)
1655 return Character::AsASCIIQuietly (span<const wchar_t>{fromStart, fromEnd}, into);
1658 "Since Stroika v3.0d1 due to http:
1660 [[deprecated (
"Since Stroika v3.0d8 - use RemoveFirstIf")]]
String Remove (Character c)
const
1664 [[deprecated (
"Since Stroika v3.0d8 - use RemoveFirstIf")]]
String Remove (
const String& subString)
const
1670 static shared_ptr<_IRep> mkEmpty_ ();
1682 template <IUNICODECanUnambiguouslyConvertFrom CHAR_T>
1683 static shared_ptr<_IRep> mk_ (span<const CHAR_T> s);
1684 template <IUNICODECanUnambiguouslyConvertFrom CHAR_T>
1685 static shared_ptr<_IRep> mk_ (Iterable<CHAR_T> it);
1686 template <IUNICODECanUnambiguouslyConvertFrom CHAR_T>
1687 static shared_ptr<_IRep> mk_ (span<CHAR_T> s);
1688 template <IStdBasicStringCompatibleCharacter CHAR_T>
1689 static shared_ptr<_IRep> mk_ (basic_string<CHAR_T>&& s);
1698 template <
typename CHAR_T>
1699 static shared_ptr<_IRep> mk_nocheck_ (span<const CHAR_T> s)
1700 requires (same_as<CHAR_T, ASCII> or same_as<CHAR_T, Latin1> or same_as<CHAR_T, char16_t> or same_as<CHAR_T, char32_t>);
1703 template <
unsigned_
integral T>
1704 nonvirtual
size_t SubString_adjust_ (T fromOrTo,
size_t myLength)
const;
1705 template <
signed_
integral T>
1706 nonvirtual
size_t SubString_adjust_ (T fromOrTo,
size_t myLength)
const;
1709 nonvirtual
String SubString_ (
const _SafeReadRepAccessor& thisAccessor,
size_t from,
size_t to)
const;
1712 nonvirtual
void _AssertRepValidType ()
const;
1715 [[noreturn]]
static void ThrowInvalidAsciiException_ ();