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 : m_string{reinterpret_cast<const char32_t*>(str.toUtf32().c_str())}
448 explicit operator sf::String()
const
450 return sf::String::fromUtf32(m_string.begin(), m_string.end());
454 explicit operator std::string()
const;
455 explicit operator std::wstring()
const;
456 explicit operator std::u16string()
const;
457 explicit operator const std::u32string&()
const
462 operator StringView() const noexcept
464#if TGUI_COMPILED_WITH_CPP_VER >= 17
467 return StringView(m_string.data(), m_string.length());
471 TGUI_NODISCARD std::string toStdString()
const;
472 TGUI_NODISCARD std::wstring toWideString()
const;
473 TGUI_NODISCARD std::u16string toUtf16()
const;
474 TGUI_NODISCARD
const std::u32string& toUtf32()
const
479 String& assign(std::size_t count,
char ch);
480 String& assign(std::size_t count,
wchar_t ch);
481 String& assign(std::size_t count,
char16_t ch);
482 String& assign(std::size_t count,
char32_t ch);
484 String& assign(StringView sv);
485 String& assign(
const char32_t* str);
486 String& assign(
const std::u32string& str);
487 String& assign(
const String& str);
489 String& assign(StringView sv, std::size_t pos, std::size_t count = npos);
490 String& assign(
const std::string& str, std::size_t pos, std::size_t count = npos);
491 String& assign(
const std::wstring& str, std::size_t pos, std::size_t count = npos);
492 String& assign(
const std::u16string& str, std::size_t pos, std::size_t count = npos);
493 String& assign(
const std::u32string& str, std::size_t pos, std::size_t count = npos);
494 String& assign(
const String& str, std::size_t pos, std::size_t count = npos);
496 String& assign(std::u32string&& str);
497 String& assign(String&& str);
499 String& assign(
const char* str, std::size_t count);
500 String& assign(
const wchar_t* str, std::size_t count);
501 String& assign(
const char16_t* str, std::size_t count);
502 String& assign(
const char32_t* str, std::size_t count);
504 String& assign(std::initializer_list<char> chars);
505 String& assign(std::initializer_list<wchar_t> chars);
506 String& assign(std::initializer_list<char16_t> chars);
507 String& assign(std::initializer_list<char32_t> chars);
509 String& assign(std::string::const_iterator first, std::string::const_iterator last);
510 String& assign(std::wstring::const_iterator first, std::wstring::const_iterator last);
511 String& assign(std::u16string::const_iterator first, std::u16string::const_iterator last);
512 String& assign(std::u32string::const_iterator first, std::u32string::const_iterator last);
513 String& assign(StringView::const_iterator first, StringView::const_iterator last);
515 TGUI_NODISCARD reference at(std::size_t pos);
516 TGUI_NODISCARD const_reference at(std::size_t pos)
const;
518 TGUI_NODISCARD const_reference operator [](std::size_t index)
const;
519 TGUI_NODISCARD reference operator [](std::size_t index);
521 TGUI_NODISCARD reference front();
522 TGUI_NODISCARD const_reference front()
const;
524 TGUI_NODISCARD reference back();
525 TGUI_NODISCARD const_reference back()
const;
527 TGUI_NODISCARD
const char32_t* data() const noexcept
529 return m_string.data();
532 TGUI_NODISCARD
char32_t* data() noexcept
534#if __cplusplus >= 201703L
535 return m_string.data();
541 TGUI_NODISCARD
const char32_t* c_str() const noexcept
543 return m_string.c_str();
546 TGUI_NODISCARD iterator begin() noexcept;
547 TGUI_NODISCARD const_iterator begin() const noexcept;
548 TGUI_NODISCARD const_iterator cbegin() const noexcept;
550 TGUI_NODISCARD iterator end() noexcept;
551 TGUI_NODISCARD const_iterator end() const noexcept;
552 TGUI_NODISCARD const_iterator cend() const noexcept;
554 TGUI_NODISCARD reverse_iterator rbegin() noexcept;
555 TGUI_NODISCARD const_reverse_iterator rbegin() const noexcept;
556 TGUI_NODISCARD const_reverse_iterator crbegin() const noexcept;
558 TGUI_NODISCARD reverse_iterator rend() noexcept;
559 TGUI_NODISCARD const_reverse_iterator rend() const noexcept;
560 TGUI_NODISCARD const_reverse_iterator crend() const noexcept;
562 TGUI_NODISCARD
bool empty() const noexcept
564 return m_string.empty();
567 TGUI_NODISCARD std::size_t size() const noexcept
569 return m_string.size();
572 TGUI_NODISCARD std::size_t length() const noexcept
574 return m_string.length();
577 TGUI_NODISCARD std::size_t max_size() const noexcept;
579 void reserve(std::
size_t newCap);
580 TGUI_NODISCARD std::
size_t capacity() const noexcept;
581 void shrink_to_fit();
583 void clear() noexcept;
585 String& insert(std::
size_t index, std::
size_t count,
char ch);
586 String& insert(std::
size_t index, std::
size_t count,
wchar_t ch);
587 String& insert(std::
size_t index, std::
size_t count,
char16_t ch);
588 String& insert(std::
size_t index, std::
size_t count,
char32_t ch);
590 String& insert(std::
size_t index, StringView sv);
591 String& insert(std::
size_t index, const
char32_t* str);
592 String& insert(std::
size_t index, const std::u32string& str);
593 String& insert(std::
size_t index, const String& str);
595 String& insert(std::
size_t index, StringView sv, std::
size_t pos, std::
size_t count = npos);
596 String& insert(std::
size_t index, const std::
string& str, std::
size_t pos, std::
size_t count = npos);
597 String& insert(std::
size_t index, const std::wstring& str, std::
size_t pos, std::
size_t count = npos);
598 String& insert(std::
size_t index, const std::u16string& str, std::
size_t pos, std::
size_t count = npos);
599 String& insert(std::
size_t index, const std::u32string& str, std::
size_t pos, std::
size_t count = npos);
600 String& insert(std::
size_t index, const String& str, std::
size_t pos, std::
size_t count = npos);
602 String& insert(std::
size_t index, const
char* str, std::
size_t count);
603 String& insert(std::
size_t index, const
wchar_t* str, std::
size_t count);
604 String& insert(std::
size_t index, const
char16_t* str, std::
size_t count);
605 String& insert(std::
size_t index, const
char32_t* str, std::
size_t count);
607 iterator insert(const_iterator pos,
char ch);
608 iterator insert(const_iterator pos,
wchar_t ch);
609 iterator insert(const_iterator pos,
char16_t ch);
610 iterator insert(const_iterator pos,
char32_t ch);
612 iterator insert(const_iterator pos, std::
size_t count,
char ch);
613 iterator insert(const_iterator pos, std::
size_t count,
wchar_t ch);
614 iterator insert(const_iterator pos, std::
size_t count,
char16_t ch);
615 iterator insert(const_iterator pos, std::
size_t count,
char32_t ch);
617 iterator insert(const_iterator pos, std::initializer_list<
char> chars);
618 iterator insert(const_iterator pos, std::initializer_list<
wchar_t> chars);
619 iterator insert(const_iterator pos, std::initializer_list<
char16_t> chars);
620 iterator insert(const_iterator pos, std::initializer_list<
char32_t> chars);
622 iterator insert(const_iterator pos, std::
string::const_iterator first, std::
string::const_iterator last);
623 iterator insert(const_iterator pos, std::wstring::const_iterator first, std::wstring::const_iterator last);
624 iterator insert(const_iterator pos, std::u16string::const_iterator first, std::u16string::const_iterator last);
625 iterator insert(const_iterator pos, std::u32string::const_iterator first, std::u32string::const_iterator last);
626 iterator insert(const_iterator pos, StringView::const_iterator first, StringView::const_iterator last);
628 String& erase(std::
size_t index = 0, std::
size_t count = npos);
630 iterator erase(const_iterator position);
631 iterator erase(const_iterator first, const_iterator last);
633 void push_back(
char ch);
634 void push_back(
wchar_t ch);
635 void push_back(
char16_t ch);
636 void push_back(
char32_t ch);
640 String& append(std::
size_t count,
char ch);
641 String& append(std::
size_t count,
wchar_t ch);
642 String& append(std::
size_t count,
char16_t ch);
643 String& append(std::
size_t count,
char32_t ch);
645 String& append(StringView sv);
646 String& append(const
char32_t* str);
647 String& append(const std::u32string& str);
648 String& append(const String& str);
650 String& append(StringView sv, std::
size_t pos, std::
size_t count = npos);
651 String& append(const std::
string& str, std::
size_t pos, std::
size_t count = npos);
652 String& append(const std::wstring& str, std::
size_t pos, std::
size_t count = npos);
653 String& append(const std::u16string& str, std::
size_t pos, std::
size_t count = npos);
654 String& append(const std::u32string& str, std::
size_t pos, std::
size_t count = npos);
655 String& append(const String& str, std::
size_t pos, std::
size_t count = npos);
657 String& append(const
char* str, std::
size_t count);
658 String& append(const
wchar_t* str, std::
size_t count);
659 String& append(const
char16_t* str, std::
size_t count);
660 String& append(const
char32_t* str, std::
size_t count);
662 String& append(std::
string::const_iterator first, std::
string::const_iterator last);
663 String& append(std::wstring::const_iterator first, std::wstring::const_iterator last);
664 String& append(std::u16string::const_iterator first, std::u16string::const_iterator last);
665 String& append(std::u32string::const_iterator first, std::u32string::const_iterator last);
666 String& append(StringView::const_iterator first, StringView::const_iterator last);
668 String& append(std::initializer_list<
char> chars);
669 String& append(std::initializer_list<
wchar_t> chars);
670 String& append(std::initializer_list<
char16_t> chars);
671 String& append(std::initializer_list<
char32_t> chars);
673 String& operator+=(const String& str);
675 TGUI_NODISCARD
int compare(StringView sv) const noexcept;
676 TGUI_NODISCARD
int compare(const
char32_t* s) const;
677 TGUI_NODISCARD
int compare(const std::u32string& str) const noexcept;
678 TGUI_NODISCARD
int compare(const String& str) const noexcept;
680 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, StringView sv) const;
681 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, const
char32_t* s) const;
682 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, const std::u32string& str) const;
683 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, const String& str) const;
685 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, StringView sv, std::
size_t pos2, std::
size_t count2 = npos) const;
686 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;
687 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;
688 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;
689 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;
690 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;
692 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, const
char* s, std::
size_t count2) const;
693 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, const
wchar_t* s, std::
size_t count2) const;
694 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, const
char16_t* s, std::
size_t count2) const;
695 TGUI_NODISCARD
int compare(std::
size_t pos1, std::
size_t count1, const
char32_t* s, std::
size_t count2) const;
697 String& replace(std::
size_t pos, std::
size_t count, StringView sv);
698 String& replace(std::
size_t pos, std::
size_t count, const
char32_t* cstr);
699 String& replace(std::
size_t pos, std::
size_t count, const std::u32string& str);
700 String& replace(std::
size_t pos, std::
size_t count, const String& str);
702 String& replace(const_iterator first, const_iterator last, StringView sv);
703 String& replace(const_iterator first, const_iterator last, const
char32_t* cstr);
704 String& replace(const_iterator first, const_iterator last, const std::u32string& str);
705 String& replace(const_iterator first, const_iterator last, const String& str);
707 String& replace(std::
size_t pos, std::
size_t count, StringView sv, std::
size_t pos2, std::
size_t count2 = npos);
708 String& replace(std::
size_t pos, std::
size_t count, const std::
string& str, std::
size_t pos2, std::
size_t count2 = npos);
709 String& replace(std::
size_t pos, std::
size_t count, const std::wstring& str, std::
size_t pos2, std::
size_t count2 = npos);
710 String& replace(std::
size_t pos, std::
size_t count, const std::u16string& str, std::
size_t pos2, std::
size_t count2 = npos);
711 String& replace(std::
size_t pos, std::
size_t count, const std::u32string& str, std::
size_t pos2, std::
size_t count2 = npos);
712 String& replace(std::
size_t pos, std::
size_t count, const String& str, std::
size_t pos2, std::
size_t count2 = npos);
714 String& replace(const_iterator first, const_iterator last, std::
string::const_iterator first2, std::
string::const_iterator last2);
715 String& replace(const_iterator first, const_iterator last, std::wstring::const_iterator first2, std::wstring::const_iterator last2);
716 String& replace(const_iterator first, const_iterator last, std::u16string::const_iterator first2, std::u16string::const_iterator last2);
717 String& replace(const_iterator first, const_iterator last, std::u32string::const_iterator first2, std::u32string::const_iterator last2);
718 String& replace(const_iterator first, const_iterator last, StringView::const_iterator first2, StringView::const_iterator last2);
720 String& replace(std::
size_t pos, std::
size_t count, const
char* cstr, std::
size_t count2);
721 String& replace(std::
size_t pos, std::
size_t count, const
wchar_t* cstr, std::
size_t count2);
722 String& replace(std::
size_t pos, std::
size_t count, const
char16_t* cstr, std::
size_t count2);
723 String& replace(std::
size_t pos, std::
size_t count, const
char32_t* cstr, std::
size_t count2);
725 String& replace(const_iterator first, const_iterator last, const
char* cstr, std::
size_t count2);
726 String& replace(const_iterator first, const_iterator last, const
wchar_t* cstr, std::
size_t count2);
727 String& replace(const_iterator first, const_iterator last, const
char16_t* cstr, std::
size_t count2);
728 String& replace(const_iterator first, const_iterator last, const
char32_t* cstr, std::
size_t count2);
730 String& replace(std::
size_t pos, std::
size_t count, std::
size_t count2,
char ch);
731 String& replace(std::
size_t pos, std::
size_t count, std::
size_t count2,
wchar_t ch);
732 String& replace(std::
size_t pos, std::
size_t count, std::
size_t count2,
char16_t ch);
733 String& replace(std::
size_t pos, std::
size_t count, std::
size_t count2,
char32_t ch);
735 String& replace(const_iterator first, const_iterator last, std::
size_t count2,
char ch);
736 String& replace(const_iterator first, const_iterator last, std::
size_t count2,
wchar_t ch);
737 String& replace(const_iterator first, const_iterator last, std::
size_t count2,
char16_t ch);
738 String& replace(const_iterator first, const_iterator last, std::
size_t count2,
char32_t ch);
740 String& replace(const_iterator first, const_iterator last, std::initializer_list<
char> chars);
741 String& replace(const_iterator first, const_iterator last, std::initializer_list<
wchar_t> chars);
742 String& replace(const_iterator first, const_iterator last, std::initializer_list<
char16_t> chars);
743 String& replace(const_iterator first, const_iterator last, std::initializer_list<
char32_t> chars);
745 TGUI_NODISCARD String substr(std::
size_t pos = 0, std::
size_t count = npos) const;
747 std::
size_t copy(
char32_t* dest, std::
size_t count, std::
size_t pos = 0) const;
749 void resize(std::
size_t count);
750 void resize(std::
size_t count,
char ch);
751 void resize(std::
size_t count,
wchar_t ch);
752 void resize(std::
size_t count,
char16_t ch);
753 void resize(std::
size_t count,
char32_t ch);
755 void swap(String& other);
757 TGUI_NODISCARD
bool contains(
char c) const noexcept;
758 TGUI_NODISCARD
bool contains(
wchar_t c) const noexcept;
759 TGUI_NODISCARD
bool contains(
char16_t c) const noexcept;
760 TGUI_NODISCARD
bool contains(
char32_t c) const noexcept;
762 TGUI_NODISCARD
bool contains(StringView sv) const noexcept;
763 TGUI_NODISCARD
bool contains(const
char32_t* s) const;
764 TGUI_NODISCARD
bool contains(const std::u32string& s) const;
765 TGUI_NODISCARD
bool contains(const String& s) const;
767 TGUI_NODISCARD std::
size_t find(StringView sv, std::
size_t pos = 0) const noexcept;
768 TGUI_NODISCARD std::
size_t find(const
char32_t* s, std::
size_t pos = 0) const;
769 TGUI_NODISCARD std::
size_t find(const std::u32string& str, std::
size_t pos = 0) const noexcept;
770 TGUI_NODISCARD std::
size_t find(const String& str, std::
size_t pos = 0) const noexcept;
772 TGUI_NODISCARD std::
size_t find(const
char* s, std::
size_t pos, std::
size_t count) const;
773 TGUI_NODISCARD std::
size_t find(const
wchar_t* s, std::
size_t pos, std::
size_t count) const;
774 TGUI_NODISCARD std::
size_t find(const
char16_t* s, std::
size_t pos, std::
size_t count) const;
775 TGUI_NODISCARD std::
size_t find(const
char32_t* s, std::
size_t pos, std::
size_t count) const;
777 TGUI_NODISCARD std::
size_t find(
char ch, std::
size_t pos = 0) const noexcept;
778 TGUI_NODISCARD std::
size_t find(
wchar_t ch, std::
size_t pos = 0) const noexcept;
779 TGUI_NODISCARD std::
size_t find(
char16_t ch, std::
size_t pos = 0) const noexcept;
780 TGUI_NODISCARD std::
size_t find(
char32_t ch, std::
size_t pos = 0) const noexcept;
782 TGUI_NODISCARD std::
size_t find_first_of(StringView sv, std::
size_t pos = 0) const noexcept;
783 TGUI_NODISCARD std::
size_t find_first_of(const
char32_t* s, std::
size_t pos = 0) const;
784 TGUI_NODISCARD std::
size_t find_first_of(const std::u32string& str, std::
size_t pos = 0) const noexcept;
785 TGUI_NODISCARD std::
size_t find_first_of(const String& str, std::
size_t pos = 0) const noexcept;
787 TGUI_NODISCARD std::
size_t find_first_of(const
char* s, std::
size_t pos, std::
size_t count) const;
788 TGUI_NODISCARD std::
size_t find_first_of(const
wchar_t* s, std::
size_t pos, std::
size_t count) const;
789 TGUI_NODISCARD std::
size_t find_first_of(const
char16_t* s, std::
size_t pos, std::
size_t count) const;
790 TGUI_NODISCARD std::
size_t find_first_of(const
char32_t* s, std::
size_t pos, std::
size_t count) const;
792 TGUI_NODISCARD std::
size_t find_first_of(
char ch, std::
size_t pos = 0) const noexcept;
793 TGUI_NODISCARD std::
size_t find_first_of(
wchar_t ch, std::
size_t pos = 0) const noexcept;
794 TGUI_NODISCARD std::
size_t find_first_of(
char16_t ch, std::
size_t pos = 0) const noexcept;
795 TGUI_NODISCARD std::
size_t find_first_of(
char32_t ch, std::
size_t pos = 0) const noexcept;
797 TGUI_NODISCARD std::
size_t find_first_not_of(StringView sv, std::
size_t pos = 0) const noexcept;
798 TGUI_NODISCARD std::
size_t find_first_not_of(const
char32_t* s, std::
size_t pos = 0) const;
799 TGUI_NODISCARD std::
size_t find_first_not_of(const std::u32string& str, std::
size_t pos = 0) const noexcept;
800 TGUI_NODISCARD std::
size_t find_first_not_of(const String& str, std::
size_t pos = 0) const noexcept;
802 TGUI_NODISCARD std::
size_t find_first_not_of(const
char* s, std::
size_t pos, std::
size_t count) const;
803 TGUI_NODISCARD std::
size_t find_first_not_of(const
wchar_t* s, std::
size_t pos, std::
size_t count) const;
804 TGUI_NODISCARD std::
size_t find_first_not_of(const
char16_t* s, std::
size_t pos, std::
size_t count) const;
805 TGUI_NODISCARD std::
size_t find_first_not_of(const
char32_t* s, std::
size_t pos, std::
size_t count) const;
807 TGUI_NODISCARD std::
size_t find_first_not_of(
char ch, std::
size_t pos = 0) const noexcept;
808 TGUI_NODISCARD std::
size_t find_first_not_of(
wchar_t ch, std::
size_t pos = 0) const noexcept;
809 TGUI_NODISCARD std::
size_t find_first_not_of(
char16_t ch, std::
size_t pos = 0) const noexcept;
810 TGUI_NODISCARD std::
size_t find_first_not_of(
char32_t ch, std::
size_t pos = 0) const noexcept;
812 TGUI_NODISCARD std::
size_t rfind(StringView sv, std::
size_t pos = npos) const noexcept;
813 TGUI_NODISCARD std::
size_t rfind(const
char32_t* s, std::
size_t pos = npos) const;
814 TGUI_NODISCARD std::
size_t rfind(const std::u32string& str, std::
size_t pos = npos) const noexcept;
815 TGUI_NODISCARD std::
size_t rfind(const String& str, std::
size_t pos = npos) const noexcept;
817 TGUI_NODISCARD std::
size_t rfind(const
char* s, std::
size_t pos, std::
size_t count) const;
818 TGUI_NODISCARD std::
size_t rfind(const
wchar_t* s, std::
size_t pos, std::
size_t count) const;
819 TGUI_NODISCARD std::
size_t rfind(const
char16_t* s, std::
size_t pos, std::
size_t count) const;
820 TGUI_NODISCARD std::
size_t rfind(const
char32_t* s, std::
size_t pos, std::
size_t count) const;
822 TGUI_NODISCARD std::
size_t rfind(
char ch, std::
size_t pos = npos) const noexcept;
823 TGUI_NODISCARD std::
size_t rfind(
wchar_t ch, std::
size_t pos = npos) const noexcept;
824 TGUI_NODISCARD std::
size_t rfind(
char16_t ch, std::
size_t pos = npos) const noexcept;
825 TGUI_NODISCARD std::
size_t rfind(
char32_t ch, std::
size_t pos = npos) const noexcept;
827 TGUI_NODISCARD std::
size_t find_last_of(StringView sv, std::
size_t pos = npos) const noexcept;
828 TGUI_NODISCARD std::
size_t find_last_of(const
char32_t* s, std::
size_t pos = npos) const;
829 TGUI_NODISCARD std::
size_t find_last_of(const std::u32string& str, std::
size_t pos = npos) const noexcept;
830 TGUI_NODISCARD std::
size_t find_last_of(const String& str, std::
size_t pos = npos) const noexcept;
832 TGUI_NODISCARD std::
size_t find_last_of(const
char* s, std::
size_t pos, std::
size_t count) const;
833 TGUI_NODISCARD std::
size_t find_last_of(const
wchar_t* s, std::
size_t pos, std::
size_t count) const;
834 TGUI_NODISCARD std::
size_t find_last_of(const
char16_t* s, std::
size_t pos, std::
size_t count) const;
835 TGUI_NODISCARD std::
size_t find_last_of(const
char32_t* s, std::
size_t pos, std::
size_t count) const;
837 TGUI_NODISCARD std::
size_t find_last_of(
char ch, std::
size_t pos = npos) const noexcept;
838 TGUI_NODISCARD std::
size_t find_last_of(
wchar_t ch, std::
size_t pos = npos) const noexcept;
839 TGUI_NODISCARD std::
size_t find_last_of(
char16_t ch, std::
size_t pos = npos) const noexcept;
840 TGUI_NODISCARD std::
size_t find_last_of(
char32_t ch, std::
size_t pos = npos) const noexcept;
842 TGUI_NODISCARD std::
size_t find_last_not_of(StringView sv, std::
size_t pos = npos) const noexcept;
843 TGUI_NODISCARD std::
size_t find_last_not_of(const
char32_t* s, std::
size_t pos = npos) const;
844 TGUI_NODISCARD std::
size_t find_last_not_of(const std::u32string& str, std::
size_t pos = npos) const noexcept;
845 TGUI_NODISCARD std::
size_t find_last_not_of(const String& str, std::
size_t pos = npos) const noexcept;
847 TGUI_NODISCARD std::
size_t find_last_not_of(const
char* s, std::
size_t pos, std::
size_t count) const;
848 TGUI_NODISCARD std::
size_t find_last_not_of(const
wchar_t* s, std::
size_t pos, std::
size_t count) const;
849 TGUI_NODISCARD std::
size_t find_last_not_of(const
char16_t* s, std::
size_t pos, std::
size_t count) const;
850 TGUI_NODISCARD std::
size_t find_last_not_of(const
char32_t* s, std::
size_t pos, std::
size_t count) const;
852 TGUI_NODISCARD std::
size_t find_last_not_of(
char ch, std::
size_t pos = npos) const noexcept;
853 TGUI_NODISCARD std::
size_t find_last_not_of(
wchar_t ch, std::
size_t pos = npos) const noexcept;
854 TGUI_NODISCARD std::
size_t find_last_not_of(
char16_t ch, std::
size_t pos = npos) const noexcept;
855 TGUI_NODISCARD std::
size_t find_last_not_of(
char32_t ch, std::
size_t pos = npos) const noexcept;
857 TGUI_NODISCARD inline
bool starts_with(StringView sv) const noexcept;
858 TGUI_NODISCARD inline
bool starts_with(const
char32_t* s) const;
859 TGUI_NODISCARD inline
bool starts_with(const std::u32string& s) const;
860 TGUI_NODISCARD inline
bool starts_with(const String& s) const;
862 TGUI_NODISCARD inline
bool starts_with(
char ch) const noexcept;
863 TGUI_NODISCARD inline
bool starts_with(
wchar_t ch) const noexcept;
864 TGUI_NODISCARD inline
bool starts_with(
char16_t ch) const noexcept;
865 TGUI_NODISCARD inline
bool starts_with(
char32_t ch) const noexcept;
867 TGUI_NODISCARD inline
bool ends_with(StringView sv) const noexcept;
868 TGUI_NODISCARD inline
bool ends_with(const
char32_t* s) const;
869 TGUI_NODISCARD inline
bool ends_with(const std::u32string& s) const;
870 TGUI_NODISCARD inline
bool ends_with(const String& s) const;
872 TGUI_NODISCARD inline
bool ends_with(
char ch) const noexcept;
873 TGUI_NODISCARD inline
bool ends_with(
wchar_t ch) const noexcept;
874 TGUI_NODISCARD inline
bool ends_with(
char16_t ch) const noexcept;
875 TGUI_NODISCARD inline
bool ends_with(
char32_t ch) const noexcept;
877 TGUI_NODISCARD std::
size_t count(const
char ch, const std::
size_t pos = 0) const noexcept;
878 TGUI_NODISCARD std::
size_t count(const
wchar_t ch, const std::
size_t pos = 0) const noexcept;
879 TGUI_NODISCARD std::
size_t count(const
char16_t ch, const std::
size_t pos = 0) const noexcept;
880 TGUI_NODISCARD std::
size_t count(const
char32_t ch, const std::
size_t pos = 0) const noexcept;
882 inline friend
bool operator==(const String& left, StringView right);
883 inline friend
bool operator==(const String& left, const
char32_t* right);
884 inline friend
bool operator==(const String& left, const std::u32string& right);
885 inline friend
bool operator==(const String& left, const String& right);
887 inline friend
bool operator!=(const String& left, StringView right);
888 inline friend
bool operator!=(const String& left, const
char32_t* right);
889 inline friend
bool operator!=(const String& left, const std::u32string& right);
890 inline friend
bool operator!=(const String& left, const String& right);
892 inline friend
bool operator<(const String& left, StringView right);
893 inline friend
bool operator<(const String& left, const
char32_t* right);
894 inline friend
bool operator<(const String& left, const std::u32string& right);
895 inline friend
bool operator<(const String& left, const String& right);
897 inline friend
bool operator<=(const String& left, StringView right);
898 inline friend
bool operator<=(const String& left, const
char32_t* right);
899 inline friend
bool operator<=(const String& left, const std::u32string& right);
900 inline friend
bool operator<=(const String& left, const String& right);
902 inline friend
bool operator>(const String& left, StringView right);
903 inline friend
bool operator>(const String& left, const
char32_t* right);
904 inline friend
bool operator>(const String& left, const std::u32string& right);
905 inline friend
bool operator>(const String& left, const String& right);
907 inline friend
bool operator>=(const String& left, StringView right);
908 inline friend
bool operator>=(const String& left, const
char32_t* right);
909 inline friend
bool operator>=(const String& left, const std::u32string& right);
910 inline friend
bool operator>=(const String& left, const String& right);
912 inline friend String operator+(const String& left, const String& right);
913 inline friend String operator+(const String& left, String&& right);
914 inline friend String operator+(String&& left, const String& right);
915 inline friend String operator+(String&& left, String&& right);
917#if defined(__cpp_lib_char8_t) && (__cpp_lib_char8_t >= 201811L)
918 inline String(
const std::u8string& str);
919 inline String(
char8_t utfChar);
920 inline String(
const char8_t* str);
921 inline String(std::size_t count,
char8_t ch);
922 inline String(
const std::u8string& str, std::size_t pos);
923 inline String(
const std::u8string& str, std::size_t pos, std::size_t count);
924 inline String(
const char8_t* str, std::size_t count);
925 inline explicit String(std::initializer_list<char8_t> chars);
926 inline explicit String(std::u8string::const_iterator first, std::u8string::const_iterator last);
928 inline explicit operator std::u8string()
const;
930 TGUI_NODISCARD
inline std::u8string toUtf8()
const;
932 inline String& assign(std::size_t count,
char8_t ch);
933 inline String& assign(
const std::u8string& str, std::size_t pos, std::size_t count = npos);
934 inline String& assign(
const char8_t* str, std::size_t count);
935 inline String& assign(std::initializer_list<char8_t> chars);
936 inline String& assign(std::u8string::const_iterator first, std::u8string::const_iterator last);
938 inline String& insert(std::size_t index, std::size_t count,
char8_t ch);
939 inline String& insert(std::size_t index,
const std::u8string& str, std::size_t pos, std::size_t count = npos);
940 inline String& insert(std::size_t index,
const char8_t* str, std::size_t count);
941 inline iterator insert(const_iterator pos,
char8_t ch);
942 inline iterator insert(const_iterator pos, std::size_t count,
char8_t ch);
943 inline iterator insert(const_iterator pos, std::initializer_list<char8_t> chars);
944 inline iterator insert(const_iterator pos, std::u8string::const_iterator first, std::u8string::const_iterator last);
946 inline String& append(std::size_t count,
char8_t ch);
947 inline String& append(
const std::u8string& str, std::size_t pos, std::size_t count = npos);
948 inline String& append(
const char8_t* str, std::size_t count);
949 inline String& append(std::initializer_list<char8_t> chars);
950 inline String& append(std::u8string::const_iterator first, std::u8string::const_iterator last);
952 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;
953 TGUI_NODISCARD
inline int compare(std::size_t pos1, std::size_t count1,
const char8_t* s, std::size_t count2)
const;
955 inline String& replace(std::size_t pos, std::size_t count,
const std::u8string& str, std::size_t pos2, std::size_t count2 = npos);
956 inline String& replace(const_iterator first, const_iterator last, std::u8string::const_iterator first2, std::u8string::const_iterator last2);
957 inline String& replace(std::size_t pos, std::size_t count,
const char8_t* cstr, std::size_t count2);
958 inline String& replace(const_iterator first, const_iterator last,
const char8_t* cstr, std::size_t count2);
959 inline String& replace(std::size_t pos, std::size_t count, std::size_t count2,
char8_t ch);
960 inline String& replace(const_iterator first, const_iterator last, std::size_t count2,
char8_t ch);
961 inline String& replace(const_iterator first, const_iterator last, std::initializer_list<char8_t> chars);
963 inline void resize(std::size_t count,
char8_t ch);
965 TGUI_NODISCARD
inline bool contains(
char8_t c)
const noexcept;
967 TGUI_NODISCARD
inline std::size_t find(
const char8_t* s, std::size_t pos, std::size_t count)
const;
968 TGUI_NODISCARD
inline std::size_t find(
char8_t ch, std::size_t pos = 0) const noexcept;
970 TGUI_NODISCARD inline std::
size_t find_first_of(const
char8_t* s, std::
size_t pos, std::
size_t count) const;
971 TGUI_NODISCARD inline std::
size_t find_first_of(
char8_t ch, std::
size_t pos = 0) const noexcept;
973 TGUI_NODISCARD inline std::
size_t find_first_not_of(const
char8_t* s, std::
size_t pos, std::
size_t count) const;
974 TGUI_NODISCARD inline std::
size_t find_first_not_of(
char8_t ch, std::
size_t pos = 0) const noexcept;
976 TGUI_NODISCARD inline std::
size_t rfind(const
char8_t* s, std::
size_t pos, std::
size_t count) const;
977 TGUI_NODISCARD inline std::
size_t rfind(
char8_t ch, std::
size_t pos = npos) const noexcept;
979 TGUI_NODISCARD inline std::
size_t find_last_of(const
char8_t* s, std::
size_t pos, std::
size_t count) const;
980 TGUI_NODISCARD inline std::
size_t find_last_of(
char8_t ch, std::
size_t pos = npos) const noexcept;
982 TGUI_NODISCARD inline std::
size_t find_last_not_of(const
char8_t* s, std::
size_t pos, std::
size_t count) const;
983 TGUI_NODISCARD inline std::
size_t find_last_not_of(
char8_t ch, std::
size_t pos = npos) const noexcept;
985 TGUI_NODISCARD inline
bool starts_with(
char8_t ch) const noexcept;
986 TGUI_NODISCARD inline
bool ends_with(
char8_t ch) const noexcept;