98 std::u32string m_string;
100#if TGUI_COMPILED_WITH_CPP_VER >= 17
102 template <
typename StringViewType>
103 using IsStringViewType = std::enable_if_t<
104 std::is_same_v<StringViewType, std::string_view>
105#if defined(__cpp_lib_char8_t) && (__cpp_lib_char8_t >= 201811L)
106 || std::is_same_v<StringViewType, std::u8string_view>
108 || std::is_same_v<StringViewType, std::wstring_view>
109 || std::is_same_v<StringViewType, std::u16string_view>
110 || std::is_same_v<StringViewType, std::u32string_view>,
116#if TGUI_COMPILED_WITH_CPP_VER >= 17
117 static constexpr auto npos = std::u32string_view::npos;
119 static const decltype(std::u32string::npos) npos;
122 using iterator = std::u32string::iterator;
123 using const_iterator = std::u32string::const_iterator;
124 using reverse_iterator = std::u32string::reverse_iterator;
125 using const_reverse_iterator = std::u32string::const_reverse_iterator;
127 using value_type = char32_t;
128 using reference =
char32_t&;
129 using const_reference =
const char32_t&;
167 TGUI_NODISCARD
int toInt(
int defaultValue = 0)
const;
176 TGUI_NODISCARD
unsigned int toUInt(
unsigned int defaultValue = 0)
const;
185 TGUI_NODISCARD
float toFloat(
float defaultValue = 0)
const;
217#ifndef TGUI_REMOVE_DEPRECATED_CODE
227 TGUI_DEPRECATED(
"Use starts_with instead") TGUI_NODISCARD
bool startsWith(const
String& substring) const;
239#ifndef TGUI_REMOVE_DEPRECATED_CODE
249 TGUI_DEPRECATED(
"Use ends_with instead") TGUI_NODISCARD
bool endsWith(const
String& substring) const;
284 TGUI_NODISCARD std::vector<String>
split(
const String& delimiter,
bool trim =
false)
const;
292 TGUI_NODISCARD
static String join(
const std::vector<String>& segments,
const String& separator);
301 template <
typename T>
307 TGUI_IF_CONSTEXPR (std::is_integral<T>::value)
309 return {std::to_string(value)};
313 std::ostringstream oss;
314 oss.imbue(std::locale::classic());
328 template <
typename T>
334 TGUI_IF_CONSTEXPR (std::is_integral<T>::value)
335 return {std::to_string(value)};
338 std::ostringstream oss;
339 oss.imbue(std::locale::classic());
340 oss << std::fixed << std::setprecision(static_cast<int>(decimals));
351 String(
const std::string& str);
352 String(
const std::wstring& str);
353 String(
const std::u16string& str);
354 String(
const std::u32string& str);
356 String(std::u32string&& str) :
357 m_string{std::move(str)}
361 String(
char ansiChar);
362 String(
wchar_t wideChar);
363 String(
char16_t utfChar);
364 String(
char32_t utfChar);
366 String(
const char* str);
367 String(
const wchar_t* str);
368 String(
const char16_t* str);
369 String(
const char32_t* str) :
375 template <typename T, typename = typename std::enable_if_t<std::is_arithmetic<T>::value, T>>
376 explicit String(T number) :
377 String{fromNumber(number)}
381 String(std::size_t count,
char ch);
382 String(std::size_t count,
wchar_t ch);
383 String(std::size_t count,
char16_t ch);
384 String(std::size_t count,
char32_t ch);
386 String(
const std::string& str, std::size_t pos);
387 String(
const std::wstring& str, std::size_t pos);
388 String(
const std::u16string& str, std::size_t pos);
389 String(
const std::u32string& str, std::size_t pos);
391 String(
const std::string& str, std::size_t pos, std::size_t count);
392 String(
const std::wstring& str, std::size_t pos, std::size_t count);
393 String(
const std::u16string& str, std::size_t pos, std::size_t count);
394 String(
const std::u32string& str, std::size_t pos, std::size_t count);
396 String(
const char* str, std::size_t count);
397 String(
const wchar_t* str, std::size_t count);
398 String(
const char16_t* str, std::size_t count);
399 String(
const char32_t* str, std::size_t count);
401 explicit String(std::initializer_list<char> chars);
402 explicit String(std::initializer_list<wchar_t> chars);
403 explicit String(std::initializer_list<char16_t> chars);
404 explicit String(std::initializer_list<char32_t> chars);
410 explicit String(std::string::const_iterator first, std::string::const_iterator last);
411 explicit String(std::wstring::const_iterator first, std::wstring::const_iterator last);
412 explicit String(std::u16string::const_iterator first, std::u16string::const_iterator last);
413 explicit String(std::u32string::const_iterator first, std::u32string::const_iterator last);
415#if TGUI_COMPILED_WITH_CPP_VER >= 17
416 template <
typename StringViewType,
typename = IsStringViewType<StringViewType>>
417 explicit String(
const StringViewType& stringView) :
418 String(stringView.data(), stringView.size())
422 template <
typename StringViewType,
typename = IsStringViewType<StringViewType>>
423 explicit String(
const StringViewType& stringView, std::size_t pos, std::size_t count) :
424 String(stringView.data() + pos, count)
428 template <
typename CharType>
429 explicit String(StringViewImpl<CharType> stringView) :
430 String(stringView.data(), stringView.size())
434 template <
typename CharType>
435 explicit String(StringViewImpl<CharType> stringView, std::size_t pos, std::size_t count) :
436 String(stringView.data() + pos, count)
441#if TGUI_HAS_WINDOW_BACKEND_SFML
443 explicit String(
const sf::String& str)
444 #if SFML_VERSION_MAJOR >= 3
445 : m_string{str.toUtf32()}
447 : m_string{
reinterpret_cast<const char32_t*
>(str.toUtf32().c_str())}
452 explicit operator sf::String()
const
454 return sf::String::fromUtf32(m_string.begin(), m_string.end());
458 explicit operator std::string()
const;
459 explicit operator std::wstring()
const;
460 explicit operator std::u16string()
const;
461 explicit operator const std::u32string&()
const
466 operator StringView() const noexcept
468#if TGUI_COMPILED_WITH_CPP_VER >= 17
471 return StringView(m_string.data(), m_string.length());
475 TGUI_NODISCARD std::string toStdString()
const;
476 TGUI_NODISCARD std::wstring toWideString()
const;
477 TGUI_NODISCARD std::u16string toUtf16()
const;
478 TGUI_NODISCARD
const std::u32string& toUtf32()
const
483 String& assign(std::size_t count,
char ch);
484 String& assign(std::size_t count,
wchar_t ch);
485 String& assign(std::size_t count,
char16_t ch);
486 String& assign(std::size_t count,
char32_t ch);
488 String& assign(StringView sv);
489 String& assign(
const char32_t* str);
490 String& assign(
const std::u32string& str);
491 String& assign(
const String& str);
493 String& assign(StringView sv, std::size_t pos, std::size_t count = npos);
494 String& assign(
const std::string& str, std::size_t pos, std::size_t count = npos);
495 String& assign(
const std::wstring& str, std::size_t pos, std::size_t count = npos);
496 String& assign(
const std::u16string& str, std::size_t pos, std::size_t count = npos);
497 String& assign(
const std::u32string& str, std::size_t pos, std::size_t count = npos);
498 String& assign(
const String& str, std::size_t pos, std::size_t count = npos);
500 String& assign(std::u32string&& str);
501 String& assign(String&& str);
503 String& assign(
const char* str, std::size_t count);
504 String& assign(
const wchar_t* str, std::size_t count);
505 String& assign(
const char16_t* str, std::size_t count);
506 String& assign(
const char32_t* str, std::size_t count);
508 String& assign(std::initializer_list<char> chars);
509 String& assign(std::initializer_list<wchar_t> chars);
510 String& assign(std::initializer_list<char16_t> chars);
511 String& assign(std::initializer_list<char32_t> chars);
513 String& assign(std::string::const_iterator first, std::string::const_iterator last);
514 String& assign(std::wstring::const_iterator first, std::wstring::const_iterator last);
515 String& assign(std::u16string::const_iterator first, std::u16string::const_iterator last);
516 String& assign(std::u32string::const_iterator first, std::u32string::const_iterator last);
517 String& assign(StringView::const_iterator first, StringView::const_iterator last);
519 TGUI_NODISCARD reference at(std::size_t pos);
520 TGUI_NODISCARD const_reference at(std::size_t pos)
const;
522 TGUI_NODISCARD const_reference operator [](std::size_t index)
const;
523 TGUI_NODISCARD reference operator [](std::size_t index);
525 TGUI_NODISCARD reference front();
526 TGUI_NODISCARD const_reference front()
const;
528 TGUI_NODISCARD reference back();
529 TGUI_NODISCARD const_reference back()
const;
531 TGUI_NODISCARD
const char32_t* data() const noexcept
533 return m_string.data();
536 TGUI_NODISCARD
char32_t* data() noexcept
538#if __cplusplus >= 201703L
539 return m_string.data();
545 TGUI_NODISCARD
const char32_t* c_str() const noexcept
547 return m_string.c_str();
550 TGUI_NODISCARD iterator begin() noexcept;
551 TGUI_NODISCARD const_iterator begin() const noexcept;
552 TGUI_NODISCARD const_iterator cbegin() const noexcept;
554 TGUI_NODISCARD iterator end() noexcept;
555 TGUI_NODISCARD const_iterator end() const noexcept;
556 TGUI_NODISCARD const_iterator cend() const noexcept;
558 TGUI_NODISCARD reverse_iterator rbegin() noexcept;
559 TGUI_NODISCARD const_reverse_iterator rbegin() const noexcept;
560 TGUI_NODISCARD const_reverse_iterator crbegin() const noexcept;
562 TGUI_NODISCARD reverse_iterator rend() noexcept;
563 TGUI_NODISCARD const_reverse_iterator rend() const noexcept;
564 TGUI_NODISCARD const_reverse_iterator crend() const noexcept;
566 TGUI_NODISCARD
bool empty() const noexcept
568 return m_string.empty();
571 TGUI_NODISCARD std::size_t size() const noexcept
573 return m_string.size();
576 TGUI_NODISCARD std::size_t length() const noexcept
578 return m_string.length();
581 TGUI_NODISCARD std::size_t max_size() const noexcept;
583 void reserve(std::
size_t newCap);
584 TGUI_NODISCARD std::
size_t capacity() const noexcept;
585 void shrink_to_fit();
587 void clear() noexcept;
589 String& insert(std::
size_t index, std::
size_t count,
char ch);
590 String& insert(std::
size_t index, std::
size_t count,
wchar_t ch);
591 String& insert(std::
size_t index, std::
size_t count,
char16_t ch);
592 String& insert(std::
size_t index, std::
size_t count,
char32_t ch);
594 String& insert(std::
size_t index, StringView sv);
595 String& insert(std::
size_t index, const
char32_t* str);
596 String& insert(std::
size_t index, const std::u32string& str);
597 String& insert(std::
size_t index, const String& str);
599 String& insert(std::
size_t index, StringView sv, std::
size_t pos, std::
size_t count = npos);
600 String& insert(std::
size_t index, const std::
string& str, std::
size_t pos, std::
size_t count = npos);
601 String& insert(std::
size_t index, const std::wstring& str, std::
size_t pos, std::
size_t count = npos);
602 String& insert(std::
size_t index, const std::u16string& str, std::
size_t pos, std::
size_t count = npos);
603 String& insert(std::
size_t index, const std::u32string& str, std::
size_t pos, std::
size_t count = npos);
604 String& insert(std::
size_t index, const String& str, std::
size_t pos, std::
size_t count = npos);
606 String& insert(std::
size_t index, const
char* str, std::
size_t count);
607 String& insert(std::
size_t index, const
wchar_t* str, std::
size_t count);
608 String& insert(std::
size_t index, const
char16_t* str, std::
size_t count);
609 String& insert(std::
size_t index, const
char32_t* str, std::
size_t count);
611 iterator insert(const_iterator pos,
char ch);
612 iterator insert(const_iterator pos,
wchar_t ch);
613 iterator insert(const_iterator pos,
char16_t ch);
614 iterator insert(const_iterator pos,
char32_t ch);
616 iterator insert(const_iterator pos, std::
size_t count,
char ch);
617 iterator insert(const_iterator pos, std::
size_t count,
wchar_t ch);
618 iterator insert(const_iterator pos, std::
size_t count,
char16_t ch);
619 iterator insert(const_iterator pos, std::
size_t count,
char32_t ch);
621 iterator insert(const_iterator pos, std::initializer_list<
char> chars);
622 iterator insert(const_iterator pos, std::initializer_list<
wchar_t> chars);
623 iterator insert(const_iterator pos, std::initializer_list<
char16_t> chars);
624 iterator insert(const_iterator pos, std::initializer_list<
char32_t> chars);
626 iterator insert(const_iterator pos, std::
string::const_iterator first, std::
string::const_iterator last);
627 iterator insert(const_iterator pos, std::wstring::const_iterator first, std::wstring::const_iterator last);
628 iterator insert(const_iterator pos, std::u16string::const_iterator first, std::u16string::const_iterator last);
629 iterator insert(const_iterator pos, std::u32string::const_iterator first, std::u32string::const_iterator last);
630 iterator insert(const_iterator pos, StringView::const_iterator first, StringView::const_iterator last);
632 String& erase(std::
size_t index = 0, std::
size_t count = npos);
634 iterator erase(const_iterator position);
635 iterator erase(const_iterator first, const_iterator last);
637 void push_back(
char ch);
638 void push_back(
wchar_t ch);
639 void push_back(
char16_t ch);
640 void push_back(
char32_t ch);
644 String& append(std::
size_t count,
char ch);
645 String& append(std::
size_t count,
wchar_t ch);
646 String& append(std::
size_t count,
char16_t ch);
647 String& append(std::
size_t count,
char32_t ch);
649 String& append(StringView sv);
650 String& append(const
char32_t* str);
651 String& append(const std::u32string& str);
652 String& append(const String& str);
654 String& append(StringView sv, std::
size_t pos, std::
size_t count = npos);
655 String& append(const std::
string& str, std::
size_t pos, std::
size_t count = npos);
656 String& append(const std::wstring& str, std::
size_t pos, std::
size_t count = npos);
657 String& append(const std::u16string& str, std::
size_t pos, std::
size_t count = npos);
658 String& append(const std::u32string& str, std::
size_t pos, std::
size_t count = npos);
659 String& append(const String& str, std::
size_t pos, std::
size_t count = npos);
661 String& append(const
char* str, std::
size_t count);
662 String& append(const
wchar_t* str, std::
size_t count);
663 String& append(const
char16_t* str, std::
size_t count);
664 String& append(const
char32_t* str, std::
size_t count);
666 String& append(std::
string::const_iterator first, std::
string::const_iterator last);
667 String& append(std::wstring::const_iterator first, std::wstring::const_iterator last);
668 String& append(std::u16string::const_iterator first, std::u16string::const_iterator last);
669 String& append(std::u32string::const_iterator first, std::u32string::const_iterator last);
670 String& append(StringView::const_iterator first, StringView::const_iterator last);
672 String& append(std::initializer_list<
char> chars);
673 String& append(std::initializer_list<
wchar_t> chars);
674 String& append(std::initializer_list<
char16_t> chars);
675 String& append(std::initializer_list<
char32_t> chars);
677 String& operator+=(const String& str);
679 TGUI_NODISCARD
int compare(StringView sv) const noexcept;
680 TGUI_NODISCARD
int compare(const
char32_t* s) const;
681 TGUI_NODISCARD
int compare(const std::u32string& str) const noexcept;
682 TGUI_NODISCARD
int compare(const String& str) const noexcept;
684 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, StringView sv) const;
685 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, const
char32_t* s) const;
686 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, const std::u32string& str) const;
687 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, const String& str) const;
689 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, StringView sv, std::
size_t pos2, std::
size_t count2 = npos) const;
690 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, const std::
string& str, std::
size_t pos2, std::
size_t count2 = npos) const;
691 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, const std::wstring& str, std::
size_t pos2, std::
size_t count2 = npos) const;
692 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, const std::u16string& str, std::
size_t pos2, std::
size_t count2 = npos) const;
693 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, const std::u32string& str, std::
size_t pos2, std::
size_t count2 = npos) const;
694 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, const String& str, std::
size_t pos2, std::
size_t count2 = npos) const;
696 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, const
char* s, std::
size_t count2) const;
697 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, const
wchar_t* s, std::
size_t count2) const;
698 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, const
char16_t* s, std::
size_t count2) const;
699 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, const
char32_t* s, std::
size_t count2) const;
701 String& replace(std::
size_t pos, std::
size_t count, StringView sv);
702 String& replace(std::
size_t pos, std::
size_t count, const
char32_t* cstr);
703 String& replace(std::
size_t pos, std::
size_t count, const std::u32string& str);
704 String& replace(std::
size_t pos, std::
size_t count, const String& str);
706 String& replace(const_iterator first, const_iterator last, StringView sv);
707 String& replace(const_iterator first, const_iterator last, const
char32_t* cstr);
708 String& replace(const_iterator first, const_iterator last, const std::u32string& str);
709 String& replace(const_iterator first, const_iterator last, const String& str);
711 String& replace(std::
size_t pos, std::
size_t count, StringView sv, std::
size_t pos2, std::
size_t count2 = npos);
712 String& replace(std::
size_t pos, std::
size_t count, const std::
string& str, std::
size_t pos2, std::
size_t count2 = npos);
713 String& replace(std::
size_t pos, std::
size_t count, const std::wstring& str, std::
size_t pos2, std::
size_t count2 = npos);
714 String& replace(std::
size_t pos, std::
size_t count, const std::u16string& str, std::
size_t pos2, std::
size_t count2 = npos);
715 String& replace(std::
size_t pos, std::
size_t count, const std::u32string& str, std::
size_t pos2, std::
size_t count2 = npos);
716 String& replace(std::
size_t pos, std::
size_t count, const String& str, std::
size_t pos2, std::
size_t count2 = npos);
718 String& replace(const_iterator first, const_iterator last, std::
string::const_iterator first2, std::
string::const_iterator last2);
719 String& replace(const_iterator first, const_iterator last, std::wstring::const_iterator first2, std::wstring::const_iterator last2);
720 String& replace(const_iterator first, const_iterator last, std::u16string::const_iterator first2, std::u16string::const_iterator last2);
721 String& replace(const_iterator first, const_iterator last, std::u32string::const_iterator first2, std::u32string::const_iterator last2);
722 String& replace(const_iterator first, const_iterator last, StringView::const_iterator first2, StringView::const_iterator last2);
724 String& replace(std::
size_t pos, std::
size_t count, const
char* cstr, std::
size_t count2);
725 String& replace(std::
size_t pos, std::
size_t count, const
wchar_t* cstr, std::
size_t count2);
726 String& replace(std::
size_t pos, std::
size_t count, const
char16_t* cstr, std::
size_t count2);
727 String& replace(std::
size_t pos, std::
size_t count, const
char32_t* cstr, std::
size_t count2);
729 String& replace(const_iterator first, const_iterator last, const
char* cstr, std::
size_t count2);
730 String& replace(const_iterator first, const_iterator last, const
wchar_t* cstr, std::
size_t count2);
731 String& replace(const_iterator first, const_iterator last, const
char16_t* cstr, std::
size_t count2);
732 String& replace(const_iterator first, const_iterator last, const
char32_t* cstr, std::
size_t count2);
734 String& replace(std::
size_t pos, std::
size_t count, std::
size_t count2,
char ch);
735 String& replace(std::
size_t pos, std::
size_t count, std::
size_t count2,
wchar_t ch);
736 String& replace(std::
size_t pos, std::
size_t count, std::
size_t count2,
char16_t ch);
737 String& replace(std::
size_t pos, std::
size_t count, std::
size_t count2,
char32_t ch);
739 String& replace(const_iterator first, const_iterator last, std::
size_t count2,
char ch);
740 String& replace(const_iterator first, const_iterator last, std::
size_t count2,
wchar_t ch);
741 String& replace(const_iterator first, const_iterator last, std::
size_t count2,
char16_t ch);
742 String& replace(const_iterator first, const_iterator last, std::
size_t count2,
char32_t ch);
744 String& replace(const_iterator first, const_iterator last, std::initializer_list<
char> chars);
745 String& replace(const_iterator first, const_iterator last, std::initializer_list<
wchar_t> chars);
746 String& replace(const_iterator first, const_iterator last, std::initializer_list<
char16_t> chars);
747 String& replace(const_iterator first, const_iterator last, std::initializer_list<
char32_t> chars);
749 TGUI_NODISCARD String substr(std::
size_t pos = 0, std::
size_t count = npos) const;
751 std::
size_t copy(
char32_t* dest, std::
size_t count, std::
size_t pos = 0) const;
753 void resize(std::
size_t count);
754 void resize(std::
size_t count,
char ch);
755 void resize(std::
size_t count,
wchar_t ch);
756 void resize(std::
size_t count,
char16_t ch);
757 void resize(std::
size_t count,
char32_t ch);
759 void swap(String& other);
761 TGUI_NODISCARD
bool contains(
char c) const noexcept;
762 TGUI_NODISCARD
bool contains(
wchar_t c) const noexcept;
763 TGUI_NODISCARD
bool contains(
char16_t c) const noexcept;
764 TGUI_NODISCARD
bool contains(
char32_t c) const noexcept;
766 TGUI_NODISCARD
bool contains(StringView sv) const noexcept;
767 TGUI_NODISCARD
bool contains(const
char32_t* s) const;
768 TGUI_NODISCARD
bool contains(const std::u32string& s) const;
769 TGUI_NODISCARD
bool contains(const String& s) const;
771 TGUI_NODISCARD std::
size_t find(StringView sv, std::
size_t pos = 0) const noexcept;
772 TGUI_NODISCARD std::
size_t find(const
char32_t* s, std::
size_t pos = 0) const;
773 TGUI_NODISCARD std::
size_t find(const std::u32string& str, std::
size_t pos = 0) const noexcept;
774 TGUI_NODISCARD std::
size_t find(const String& str, std::
size_t pos = 0) const noexcept;
776 TGUI_NODISCARD std::
size_t find(const
char* s, std::
size_t pos, std::
size_t count) const;
777 TGUI_NODISCARD std::
size_t find(const
wchar_t* s, std::
size_t pos, std::
size_t count) const;
778 TGUI_NODISCARD std::
size_t find(const
char16_t* s, std::
size_t pos, std::
size_t count) const;
779 TGUI_NODISCARD std::
size_t find(const
char32_t* s, std::
size_t pos, std::
size_t count) const;
781 TGUI_NODISCARD std::
size_t find(
char ch, std::
size_t pos = 0) const noexcept;
782 TGUI_NODISCARD std::
size_t find(
wchar_t ch, std::
size_t pos = 0) const noexcept;
783 TGUI_NODISCARD std::
size_t find(
char16_t ch, std::
size_t pos = 0) const noexcept;
784 TGUI_NODISCARD std::
size_t find(
char32_t ch, std::
size_t pos = 0) const noexcept;
786 TGUI_NODISCARD std::
size_t find_first_of(StringView sv, std::
size_t pos = 0) const noexcept;
787 TGUI_NODISCARD std::
size_t find_first_of(const
char32_t* s, std::
size_t pos = 0) const;
788 TGUI_NODISCARD std::
size_t find_first_of(const std::u32string& str, std::
size_t pos = 0) const noexcept;
789 TGUI_NODISCARD std::
size_t find_first_of(const String& str, std::
size_t pos = 0) const noexcept;
791 TGUI_NODISCARD std::
size_t find_first_of(const
char* s, std::
size_t pos, std::
size_t count) const;
792 TGUI_NODISCARD std::
size_t find_first_of(const
wchar_t* s, std::
size_t pos, std::
size_t count) const;
793 TGUI_NODISCARD std::
size_t find_first_of(const
char16_t* s, std::
size_t pos, std::
size_t count) const;
794 TGUI_NODISCARD std::
size_t find_first_of(const
char32_t* s, std::
size_t pos, std::
size_t count) const;
796 TGUI_NODISCARD std::
size_t find_first_of(
char ch, std::
size_t pos = 0) const noexcept;
797 TGUI_NODISCARD std::
size_t find_first_of(
wchar_t ch, std::
size_t pos = 0) const noexcept;
798 TGUI_NODISCARD std::
size_t find_first_of(
char16_t ch, std::
size_t pos = 0) const noexcept;
799 TGUI_NODISCARD std::
size_t find_first_of(
char32_t ch, std::
size_t pos = 0) const noexcept;
801 TGUI_NODISCARD std::
size_t find_first_not_of(StringView sv, std::
size_t pos = 0) const noexcept;
802 TGUI_NODISCARD std::
size_t find_first_not_of(const
char32_t* s, std::
size_t pos = 0) const;
803 TGUI_NODISCARD std::
size_t find_first_not_of(const std::u32string& str, std::
size_t pos = 0) const noexcept;
804 TGUI_NODISCARD std::
size_t find_first_not_of(const String& str, std::
size_t pos = 0) const noexcept;
806 TGUI_NODISCARD std::
size_t find_first_not_of(const
char* s, std::
size_t pos, std::
size_t count) const;
807 TGUI_NODISCARD std::
size_t find_first_not_of(const
wchar_t* s, std::
size_t pos, std::
size_t count) const;
808 TGUI_NODISCARD std::
size_t find_first_not_of(const
char16_t* s, std::
size_t pos, std::
size_t count) const;
809 TGUI_NODISCARD std::
size_t find_first_not_of(const
char32_t* s, std::
size_t pos, std::
size_t count) const;
811 TGUI_NODISCARD std::
size_t find_first_not_of(
char ch, std::
size_t pos = 0) const noexcept;
812 TGUI_NODISCARD std::
size_t find_first_not_of(
wchar_t ch, std::
size_t pos = 0) const noexcept;
813 TGUI_NODISCARD std::
size_t find_first_not_of(
char16_t ch, std::
size_t pos = 0) const noexcept;
814 TGUI_NODISCARD std::
size_t find_first_not_of(
char32_t ch, std::
size_t pos = 0) const noexcept;
816 TGUI_NODISCARD std::
size_t rfind(StringView sv, std::
size_t pos = npos) const noexcept;
817 TGUI_NODISCARD std::
size_t rfind(const
char32_t* s, std::
size_t pos = npos) const;
818 TGUI_NODISCARD std::
size_t rfind(const std::u32string& str, std::
size_t pos = npos) const noexcept;
819 TGUI_NODISCARD std::
size_t rfind(const String& str, std::
size_t pos = npos) const noexcept;
821 TGUI_NODISCARD std::
size_t rfind(const
char* s, std::
size_t pos, std::
size_t count) const;
822 TGUI_NODISCARD std::
size_t rfind(const
wchar_t* s, std::
size_t pos, std::
size_t count) const;
823 TGUI_NODISCARD std::
size_t rfind(const
char16_t* s, std::
size_t pos, std::
size_t count) const;
824 TGUI_NODISCARD std::
size_t rfind(const
char32_t* s, std::
size_t pos, std::
size_t count) const;
826 TGUI_NODISCARD std::
size_t rfind(
char ch, std::
size_t pos = npos) const noexcept;
827 TGUI_NODISCARD std::
size_t rfind(
wchar_t ch, std::
size_t pos = npos) const noexcept;
828 TGUI_NODISCARD std::
size_t rfind(
char16_t ch, std::
size_t pos = npos) const noexcept;
829 TGUI_NODISCARD std::
size_t rfind(
char32_t ch, std::
size_t pos = npos) const noexcept;
831 TGUI_NODISCARD std::
size_t find_last_of(StringView sv, std::
size_t pos = npos) const noexcept;
832 TGUI_NODISCARD std::
size_t find_last_of(const
char32_t* s, std::
size_t pos = npos) const;
833 TGUI_NODISCARD std::
size_t find_last_of(const std::u32string& str, std::
size_t pos = npos) const noexcept;
834 TGUI_NODISCARD std::
size_t find_last_of(const String& str, std::
size_t pos = npos) const noexcept;
836 TGUI_NODISCARD std::
size_t find_last_of(const
char* s, std::
size_t pos, std::
size_t count) const;
837 TGUI_NODISCARD std::
size_t find_last_of(const
wchar_t* s, std::
size_t pos, std::
size_t count) const;
838 TGUI_NODISCARD std::
size_t find_last_of(const
char16_t* s, std::
size_t pos, std::
size_t count) const;
839 TGUI_NODISCARD std::
size_t find_last_of(const
char32_t* s, std::
size_t pos, std::
size_t count) const;
841 TGUI_NODISCARD std::
size_t find_last_of(
char ch, std::
size_t pos = npos) const noexcept;
842 TGUI_NODISCARD std::
size_t find_last_of(
wchar_t ch, std::
size_t pos = npos) const noexcept;
843 TGUI_NODISCARD std::
size_t find_last_of(
char16_t ch, std::
size_t pos = npos) const noexcept;
844 TGUI_NODISCARD std::
size_t find_last_of(
char32_t ch, std::
size_t pos = npos) const noexcept;
846 TGUI_NODISCARD std::
size_t find_last_not_of(StringView sv, std::
size_t pos = npos) const noexcept;
847 TGUI_NODISCARD std::
size_t find_last_not_of(const
char32_t* s, std::
size_t pos = npos) const;
848 TGUI_NODISCARD std::
size_t find_last_not_of(const std::u32string& str, std::
size_t pos = npos) const noexcept;
849 TGUI_NODISCARD std::
size_t find_last_not_of(const String& str, std::
size_t pos = npos) const noexcept;
851 TGUI_NODISCARD std::
size_t find_last_not_of(const
char* s, std::
size_t pos, std::
size_t count) const;
852 TGUI_NODISCARD std::
size_t find_last_not_of(const
wchar_t* s, std::
size_t pos, std::
size_t count) const;
853 TGUI_NODISCARD std::
size_t find_last_not_of(const
char16_t* s, std::
size_t pos, std::
size_t count) const;
854 TGUI_NODISCARD std::
size_t find_last_not_of(const
char32_t* s, std::
size_t pos, std::
size_t count) const;
856 TGUI_NODISCARD std::
size_t find_last_not_of(
char ch, std::
size_t pos = npos) const noexcept;
857 TGUI_NODISCARD std::
size_t find_last_not_of(
wchar_t ch, std::
size_t pos = npos) const noexcept;
858 TGUI_NODISCARD std::
size_t find_last_not_of(
char16_t ch, std::
size_t pos = npos) const noexcept;
859 TGUI_NODISCARD std::
size_t find_last_not_of(
char32_t ch, std::
size_t pos = npos) const noexcept;
861 TGUI_NODISCARD inline
bool starts_with(StringView sv) const noexcept;
862 TGUI_NODISCARD inline
bool starts_with(const
char32_t* s) const;
863 TGUI_NODISCARD inline
bool starts_with(const std::u32string& s) const;
864 TGUI_NODISCARD inline
bool starts_with(const String& s) const;
866 TGUI_NODISCARD inline
bool starts_with(
char ch) const noexcept;
867 TGUI_NODISCARD inline
bool starts_with(
wchar_t ch) const noexcept;
868 TGUI_NODISCARD inline
bool starts_with(
char16_t ch) const noexcept;
869 TGUI_NODISCARD inline
bool starts_with(
char32_t ch) const noexcept;
871 TGUI_NODISCARD inline
bool ends_with(StringView sv) const noexcept;
872 TGUI_NODISCARD inline
bool ends_with(const
char32_t* s) const;
873 TGUI_NODISCARD inline
bool ends_with(const std::u32string& s) const;
874 TGUI_NODISCARD inline
bool ends_with(const String& s) const;
876 TGUI_NODISCARD inline
bool ends_with(
char ch) const noexcept;
877 TGUI_NODISCARD inline
bool ends_with(
wchar_t ch) const noexcept;
878 TGUI_NODISCARD inline
bool ends_with(
char16_t ch) const noexcept;
879 TGUI_NODISCARD inline
bool ends_with(
char32_t ch) const noexcept;
881 TGUI_NODISCARD std::
size_t count(const
char ch, const std::
size_t pos = 0) const noexcept;
882 TGUI_NODISCARD std::
size_t count(const
wchar_t ch, const std::
size_t pos = 0) const noexcept;
883 TGUI_NODISCARD std::
size_t count(const
char16_t ch, const std::
size_t pos = 0) const noexcept;
884 TGUI_NODISCARD std::
size_t count(const
char32_t ch, const std::
size_t pos = 0) const noexcept;
886 inline friend
bool operator==(const String& left, StringView right);
887 inline friend
bool operator==(const String& left, const
char32_t* right);
888 inline friend
bool operator==(const String& left, const std::u32string& right);
889 inline friend
bool operator==(const String& left, const String& right);
891 inline friend
bool operator!=(const String& left, StringView right);
892 inline friend
bool operator!=(const String& left, const
char32_t* right);
893 inline friend
bool operator!=(const String& left, const std::u32string& right);
894 inline friend
bool operator!=(const String& left, const String& right);
896 inline friend
bool operator<(const String& left, StringView right);
897 inline friend
bool operator<(const String& left, const
char32_t* right);
898 inline friend
bool operator<(const String& left, const std::u32string& right);
899 inline friend
bool operator<(const String& left, const String& right);
901 inline friend
bool operator<=(const String& left, StringView right);
902 inline friend
bool operator<=(const String& left, const
char32_t* right);
903 inline friend
bool operator<=(const String& left, const std::u32string& right);
904 inline friend
bool operator<=(const String& left, const String& right);
906 inline friend
bool operator>(const String& left, StringView right);
907 inline friend
bool operator>(const String& left, const
char32_t* right);
908 inline friend
bool operator>(const String& left, const std::u32string& right);
909 inline friend
bool operator>(const String& left, const String& right);
911 inline friend
bool operator>=(const String& left, StringView right);
912 inline friend
bool operator>=(const String& left, const
char32_t* right);
913 inline friend
bool operator>=(const String& left, const std::u32string& right);
914 inline friend
bool operator>=(const String& left, const String& right);
916 inline friend String operator+(const String& left, const String& right);
917 inline friend String operator+(const String& left, String&& right);
918 inline friend String operator+(String&& left, const String& right);
919 inline friend String operator+(String&& left, String&& right);
921#if defined(__cpp_lib_char8_t) && (__cpp_lib_char8_t >= 201811L)
922 inline String(
const std::u8string& str);
923 inline String(
char8_t utfChar);
924 inline String(
const char8_t* str);
925 inline String(std::size_t count,
char8_t ch);
926 inline String(
const std::u8string& str, std::size_t pos);
927 inline String(
const std::u8string& str, std::size_t pos, std::size_t count);
928 inline String(
const char8_t* str, std::size_t count);
929 inline explicit String(std::initializer_list<char8_t> chars);
930 inline explicit String(std::u8string::const_iterator first, std::u8string::const_iterator last);
932 inline explicit operator std::u8string()
const;
934 TGUI_NODISCARD
inline std::u8string toUtf8()
const;
936 inline String& assign(std::size_t count,
char8_t ch);
937 inline String& assign(
const std::u8string& str, std::size_t pos, std::size_t count = npos);
938 inline String& assign(
const char8_t* str, std::size_t count);
939 inline String& assign(std::initializer_list<char8_t> chars);
940 inline String& assign(std::u8string::const_iterator first, std::u8string::const_iterator last);
942 inline String& insert(std::size_t index, std::size_t count,
char8_t ch);
943 inline String& insert(std::size_t index,
const std::u8string& str, std::size_t pos, std::size_t count = npos);
944 inline String& insert(std::size_t index,
const char8_t* str, std::size_t count);
945 inline iterator insert(const_iterator pos,
char8_t ch);
946 inline iterator insert(const_iterator pos, std::size_t count,
char8_t ch);
947 inline iterator insert(const_iterator pos, std::initializer_list<char8_t> chars);
948 inline iterator insert(const_iterator pos, std::u8string::const_iterator first, std::u8string::const_iterator last);
950 inline String& append(std::size_t count,
char8_t ch);
951 inline String& append(
const std::u8string& str, std::size_t pos, std::size_t count = npos);
952 inline String& append(
const char8_t* str, std::size_t count);
953 inline String& append(std::initializer_list<char8_t> chars);
954 inline String& append(std::u8string::const_iterator first, std::u8string::const_iterator last);
956 TGUI_NODISCARD
inline int compare(std::size_t pos1, std::size_t count1,
const std::u8string& str, std::size_t pos2, std::size_t count2 = npos)
const;
957 TGUI_NODISCARD
inline int compare(std::size_t pos1, std::size_t count1,
const char8_t* s, std::size_t count2)
const;
959 inline String& replace(std::size_t pos, std::size_t count,
const std::u8string& str, std::size_t pos2, std::size_t count2 = npos);
960 inline String& replace(const_iterator first, const_iterator last, std::u8string::const_iterator first2, std::u8string::const_iterator last2);
961 inline String& replace(std::size_t pos, std::size_t count,
const char8_t* cstr, std::size_t count2);
962 inline String& replace(const_iterator first, const_iterator last,
const char8_t* cstr, std::size_t count2);
963 inline String& replace(std::size_t pos, std::size_t count, std::size_t count2,
char8_t ch);
964 inline String& replace(const_iterator first, const_iterator last, std::size_t count2,
char8_t ch);
965 inline String& replace(const_iterator first, const_iterator last, std::initializer_list<char8_t> chars);
967 inline void resize(std::size_t count,
char8_t ch);
969 TGUI_NODISCARD
inline bool contains(
char8_t c)
const noexcept;
971 TGUI_NODISCARD
inline std::size_t find(
const char8_t* s, std::size_t pos, std::size_t count)
const;
972 TGUI_NODISCARD
inline std::size_t find(
char8_t ch, std::size_t pos = 0) const noexcept;
974 TGUI_NODISCARD inline std::
size_t find_first_of(const
char8_t* s, std::
size_t pos, std::
size_t count) const;
975 TGUI_NODISCARD inline std::
size_t find_first_of(
char8_t ch, std::
size_t pos = 0) const noexcept;
977 TGUI_NODISCARD inline std::
size_t find_first_not_of(const
char8_t* s, std::
size_t pos, std::
size_t count) const;
978 TGUI_NODISCARD inline std::
size_t find_first_not_of(
char8_t ch, std::
size_t pos = 0) const noexcept;
980 TGUI_NODISCARD inline std::
size_t rfind(const
char8_t* s, std::
size_t pos, std::
size_t count) const;
981 TGUI_NODISCARD inline std::
size_t rfind(
char8_t ch, std::
size_t pos = npos) const noexcept;
983 TGUI_NODISCARD inline std::
size_t find_last_of(const
char8_t* s, std::
size_t pos, std::
size_t count) const;
984 TGUI_NODISCARD inline std::
size_t find_last_of(
char8_t ch, std::
size_t pos = npos) const noexcept;
986 TGUI_NODISCARD inline std::
size_t find_last_not_of(const
char8_t* s, std::
size_t pos, std::
size_t count) const;
987 TGUI_NODISCARD inline std::
size_t find_last_not_of(
char8_t ch, std::
size_t pos = npos) const noexcept;
989 TGUI_NODISCARD inline
bool starts_with(
char8_t ch) const noexcept;
990 TGUI_NODISCARD inline
bool ends_with(
char8_t ch) const noexcept;