88 public ::const_string_range < ITERATOR_TYPE >
94 using BASE_RANGE = ::const_string_range < ITERATOR_TYPE >;
95 using this_iterator =
typename BASE_RANGE::this_iterator;
96 using iterator =
typename BASE_RANGE::iterator;
97 using const_iterator =
typename BASE_RANGE::const_iterator;
104 using ITEM_POINTER = get_type_item_pointer< this_iterator >;
105 using ITEM = ::const_string_range < ITERATOR_TYPE >::ITEM;
106 using CHARACTER = ::const_string_range < ITERATOR_TYPE >::CHARACTER;
108 using BASE_DATA = BASE_RANGE::BASE_DATA;
109 using SCOPED_STRING = scoped_string_base < this_iterator >;
112 string_base() { default_construct(); }
114 string_base(nullptr_t) { default_construct(); }
123 template < typed_character_pointer < typename scoped_string_base < ITERATOR_TYPE >::CHARACTER > CHARACTER_POINTER >
124 string_base(CHARACTER_POINTER start, CHARACTER_POINTER end, enum_range erange) :
128 this->construct_from_a_range(start, end, erange);
133 template < other_character_pointer < typename scoped_string_base < ITERATOR_TYPE >::CHARACTER > OTHER_CHARACTER_POINTER >
134 string_base(OTHER_CHARACTER_POINTER start, OTHER_CHARACTER_POINTER end, enum_range erange = e_range_none) :
138 this->construct_from_a_range(start, end, erange);
143 string_base(
const string_base& str) :
147 this->construct_from_string(str);
152 template < prototype_std_
string STDSTRING >
153 string_base(
const STDSTRING & stdstring) : string_base(stdstring.c_str(), stdstring.length()) {}
188 template <
typename RANGE >
189 string_base(
const RANGE & str)
requires
190 (::std::is_base_of_v < ::character_range < const typename string_base < ITERATOR_TYPE >::CHARACTER* >, RANGE >
192 (::std::is_base_of_v < string_base < ITERATOR_TYPE >, RANGE >
193 || ::std::is_same_v < string_base < ITERATOR_TYPE >, RANGE >)) :
197 construct_from_a_range(str);
202 template <
typename RANGE,
typename RANGE2 >
203 string_base(
const RANGE& range1,
const RANGE2 & range2)
requires
204 ::std::is_base_of_v < ::character_range < const typename string_base < ITERATOR_TYPE >::CHARACTER* >, RANGE >
206 ::std::is_base_of_v < ::character_range < const typename string_base < ITERATOR_TYPE >::CHARACTER* >, RANGE2 >:
210 construct_from_two_ranges_concatenation(range1, range2);
215 template <
typename OTHER_CHARACTER >
216 string_base(const ::character_range < const OTHER_CHARACTER* >&
range)
217 requires other_primitive_character < OTHER_CHARACTER, CHARACTER >:
229 string_base(string_base && str) :
232 this->m_begin = str.m_begin;
233 this->m_end = str.m_end;
234 this->m_erange = str.m_erange;
235 this->m_pbasedata = str.m_pbasedata;
236 str.m_begin =
nullptr;
238 str.m_erange = e_range_none;
239 str.m_pbasedata =
nullptr;
242 string_base(const ::c::string & cstring);
322 template < prototype_block BLOCK >
323 string_base(
const BLOCK & block) : string_base((
const CHARACTER *)block.begin(), (
const CHARACTER *)block.end()) {}
324 template <
character_po
inter CHARACTER_POINTER >
325 string_base(CHARACTER_POINTER start, character_count length) : ::const_string_range<ITERATOR_TYPE>(
no_initialize_t{}) { construct_from_range(start, length); }
326 template <
character_po
inter CHARACTER_POINTER >
327 string_base(CHARACTER_POINTER start, CHARACTER_POINTER end) : string_base(start, end-start) { }
328 template <
character_po
inter CHARACTER_POINTER >
329 string_base(CHARACTER_POINTER s1, CHARACTER_POINTER e1, CHARACTER_POINTER s2, CHARACTER_POINTER e2);
330 template <
character_po
inter CHARACTER_POINTER >
331 string_base(CHARACTER_POINTER start) : string_base(start, string_safe_length(start)) {}
332 template < prototype_
character CHARACTER2 >
333 string_base(
const CHARACTER2*start, character_count length, enum_range erange) :
334 string_base(start, start + length, erange) { }
339 template < prototype_
character CHARACTER2,
character_count sizeMaximumLength >
340 string_base(
const inline_string < CHARACTER2, sizeMaximumLength > & inlinestring) :
341 string_base(inlinestring.begin(), inlinestring.end())
354 string_base(const_iterator begin, const_iterator end) : string_base(begin, end - begin) { }
368 template <
typename OTHER_CHARACTER >
369 string_base(OTHER_CHARACTER chSrc, character_count repeat = 1)
370 requires other_primitive_character < OTHER_CHARACTER, CHARACTER > ;
371 string_base(CHARACTER chSrc, character_count repeat = 1);
377#if defined(__STD_FORMAT__)
378 string_base(const ::std::string & str) : string_base(str.c_str()) { }
380 string_base(const ::atom &
atom);
381 string_base(const ::payload &
payload);
382 string_base(const ::property &
property);
385 inline ~string_base()
426 inline void destroy()
429 if (this->has_string_storage() && ::is_set(this->m_begin))
432 ::base_data_defer_release(this->m_pbasedata);
436 this->m_begin =
nullptr;
438 this->m_end =
nullptr;
440 this->m_erange = e_range_none;
446 const ::block as_block()
const {
return { (::u8 *)this->begin(), this->character_count_in_bytes() }; }
448 static consteval bool is_null_terminated() {
return true; }
450 void default_construct()
453 this->m_begin = ønil_character_data<CHARACTER>::get();
455 this->m_end = this->m_begin;
457 this->m_erange = e_range_string_literal;
459 this->m_pbasedata =
nullptr;
472 template < typed_character_pointer < typename scoped_string_base < ITERATOR_TYPE >::CHARACTER > CHARACTER_POINTER >
473 void construct_from_a_range(CHARACTER_POINTER start, CHARACTER_POINTER end, enum_range erange = e_range_none, BASE_DATA * pbasedata =
nullptr)
479 this->default_construct();
485 if (::is_set(pbasedata))
488 this->m_begin = start;
494 this->m_pbasedata = pbasedata;
496 pbasedata->base_data_increment_reference_count();
502 auto lengthNew = end - start;
504 pbasedata = create_string_data(lengthNew + 1);
506 auto pdata = pbasedata->data();
508 this->m_begin = pdata;
510 this->m_end = this->m_begin + lengthNew;
512 memory_transfer(pdata, start, lengthNew);
514 this->_set_length(lengthNew);
516 this->m_erange = e_range_none;
518 this->m_pbasedata = pbasedata;
523 template < other_character_pointer < typename scoped_string_base < ITERATOR_TYPE >::CHARACTER > OTHER_CHARACTER_POINTER >
524 void construct_from_a_range(OTHER_CHARACTER_POINTER start, OTHER_CHARACTER_POINTER end, enum_range erange = e_range_none)
527 auto length = end - start;
529 auto lengthNew = utf_to_utf_length(this->m_begin, start, length);
531 if (::is_null(start) || end <= start)
534 this->default_construct();
541 auto pbasedata = BASE_DATA::create_base_data(lengthNew + 1);
543 auto pdata = pbasedata->data();
545 this->m_pbasedata = pbasedata;
547 this->m_erange = e_range_none;
549 this->m_begin = pdata;
551 utf_to_utf(this->m_begin, start, lengthNew);
553 this->_set_length(lengthNew);
558 void construct_from_string(
const string_base& str);
567 template < prototype_
character_range RANGE >
568 void construct_from_a_range(
const RANGE&
range)
571 if (
range.m_pbasedata)
574 if constexpr (
sizeof(
typename RANGE::ITEM) ==
sizeof(CHARACTER))
577 this->construct_from_string(*(
const string_base*)&
range);
583 this->construct_from_range(
range.data(),
range.size());
588 else if (
range.m_erange & e_range_string_literal)
591 this->m_begin =
range.m_begin;
592 this->m_end =
range.m_end;
593 this->m_erange =
range.m_erange;
594 this->m_pbasedata =
nullptr;
600 this->construct_from_range(
range.data(),
range.size());
619 inline void construct_from_range(ITERATOR_TYPE pSrc, character_count length);
621 template <
typename OTHER_CHARACTER_POINTER >
622 inline void construct_from_range(OTHER_CHARACTER_POINTER pSrc, character_count length)
623 requires other_character_pointer < OTHER_CHARACTER_POINTER, ITERATOR_TYPE > ;
629 template <
typename OTHER_CHARACTER >
630 inline void construct20(
const OTHER_CHARACTER * psz, character_count length, enum_range erange)
631 requires (other_primitive_character < OTHER_CHARACTER, CHARACTER >);
638 template <
typename RANGE1,
typename RANGE2 >
639 void construct_from_two_ranges_concatenation(
const RANGE1& range1,
const RANGE2& range2);
647 template < prototype_
character CHARACTER2 >
648 character_count start_count_length(character_count & start, character_count & count,
const CHARACTER2 * pszSource);
651 inline const string_base & to_string()
const {
return *
this; }
654 inline const CHARACTER *c_str()
const {
return this->data(); }
656 inline const CHARACTER *c_str_for_printf()
const {
return this->data(); }
659 using const_string_range<ITERATOR_TYPE>::begin;
660 using const_string_range<ITERATOR_TYPE>::end;
663 this_iterator & begin(this_iterator begin)
666 return erase_beginning(begin);
671 this_iterator & end(this_iterator end)
674 return truncate(end);
679 bool contains_erase(
const SCOPED_STRING& scopedstr)
682 if (scopedstr.is_empty())
690 bool bContains =
false;
695 auto p = this->find(scopedstr);
706 this->erase(p, scopedstr.size());
725 string_base to_string_base()
const {
return *
this; }
726 const BASE_RANGE & to_string_base() {
return *
this; }
728 using BASE_RANGE::operator ==;
729 using BASE_RANGE::operator <=>;
731 bool operator==(
const string_base & str)
const {
return this->equals(str); }
732 ::std::strong_ordering operator<=>(
const string_base & str)
const {
return this->order(str); }
809 string_base &operator =(
const string_base & str)
811 this->assign_range(str);
817 template <
typename RANGE >
818 string_base & operator = (
const RANGE & str)
requires
819 (::std::is_base_of_v < ::character_range < const typename string_base < ITERATOR_TYPE >::CHARACTER* >, RANGE >
821 (::std::is_base_of_v < string_base < ITERATOR_TYPE >, RANGE >
822 || ::std::is_same_v < string_base < ITERATOR_TYPE >, RANGE >))
824 this->assign_range(str);
829 template < prototype_
character_range SOME_RANGE >
830 string_base &operator=(SOME_RANGE && range)
832 this->transfer_range(::transfer(range));
915 string_base & operator += (
const SCOPED_STRING & scopedstr);
917 template < prototype_
character CHARACTER >
918 string_base & operator += (CHARACTER character) { this->append_character(character);
return *
this; }
1003 string_base& surround(
const SCOPED_STRING& scopedstr);
1005 string_base& surround(
const SCOPED_STRING& scopedstrLeft,
const SCOPED_STRING& scopedstrRight);
1007 string_base& f64_quote(
bool bEscape =
false);
1009 string_base& single_quote(
bool bEscape =
false);
1027 ::character_count size_with_null_terminator()
const
1030 return this->size() + 1;
1035 ::character_count size_in_bytes_with_null_terminator()
const
1038 return this->size_with_null_terminator() * this->item_size();
1043 inline const ::block block_with_null_terminator()
const;
1046 template<
typename SAME_CHARACTER_RANGE >
1047 string_base &assign_range(
const SAME_CHARACTER_RANGE & range)
1048 requires (typed_character_range<SAME_CHARACTER_RANGE, CHARACTER>)
1051 if ((::character_range<const CHARACTER *> *)(
this) == (::character_range<const CHARACTER *> *)(&range))
1058 auto pdataThis = this->m_pbasedata;
1060 if (range.m_pbasedata)
1063 this->m_begin = range.m_begin;
1065 this->m_end = range.m_end;
1069 this->m_pbasedata = range.m_pbasedata;
1071 this->m_pbasedata->base_data_increment_reference_count();
1074 else if (::is_null(range.m_begin) || range.m_end <= range.m_begin)
1077 this->default_construct();
1083 auto length = range.size();
1085 auto lengthNew = string_safe_length2(range.m_begin, length);
1087 if (::is_set(pdataThis) &&
1088 !pdataThis->base_data_is_shared() &&
1089 lengthNew <= pdataThis->storage_character_count())
1092 pdataThis =
nullptr;
1098 auto pbasedata = this->create_string_data2(lengthNew, this->m_erange);
1100 this->m_begin = pbasedata->data();
1104 ::memory_transfer((
void *) this->m_begin, range.m_begin,
sizeof(CHARACTER) * lengthNew);
1106 this->_set_length(lengthNew);
1113 ::base_data_defer_release(pdataThis);
1122 template<
typename SAME_CHARACTER_RANGE>
1123 string_base &transfer_range(SAME_CHARACTER_RANGE &&range)
1124 requires(typed_character_range<SAME_CHARACTER_RANGE, CHARACTER>)
1127 if((::character_range<const CHARACTER *>*)(
this) == (::character_range<const CHARACTER *>*)(&range))
1134 auto pdataThis = this->m_pbasedata;
1136 if (::is_set(range.m_pbasedata))
1139 this->m_begin = range.m_begin;
1141 this->m_end = range.m_end;
1145 this->m_pbasedata = range.m_pbasedata;
1148 else if (::is_null(range.m_begin) || range.m_end <= range.m_begin)
1151 this->default_construct();
1157 auto lengthNew = range.size();
1159 if (::is_set(pdataThis) &&
1160 !pdataThis->base_data_is_shared() &&
1161 lengthNew <= pdataThis->storage_character_count())
1164 pdataThis =
nullptr;
1170 auto pbasedata = this->create_string_data2(lengthNew, this->m_erange);
1172 this->m_begin = pbasedata->data();
1176 ::memory_transfer((
void *) this->m_begin, range.m_begin,
sizeof(CHARACTER) * lengthNew);
1178 this->_set_length(lengthNew);
1185 ::base_data_defer_release(pdataThis);
1189 range.m_begin =
nullptr;
1191 range.m_end =
nullptr;
1193 range.m_erange = e_range_none;
1195 range.m_pbasedata =
nullptr;
1203 template<
typename OTHER_CHARACTER_RANGE>
1204 string_base &assign_range(
const OTHER_CHARACTER_RANGE &range)
1205 requires(other_character_range<OTHER_CHARACTER_RANGE, CHARACTER>)
1208 this->assign(range.m_begin, range.m_end);
1215 template <
typename OTHER_CHARACTER_RANGE >
1216 inline string_base & transfer_range(OTHER_CHARACTER_RANGE && range)
1217 requires(other_character_range<OTHER_CHARACTER_RANGE, CHARACTER>)
1220 this->assign(range.m_begin, range.m_end);
1222 range.m_begin =
nullptr;
1224 range.m_end =
nullptr;
1226 range.m_erange = e_range_none;
1233 template < prototype_block BLOCK >
1234 inline string_base & assign(
const BLOCK & block) {
return assign((
const CHARACTER *)block.data(),(
const CHARACTER *) block.end()); }
1249 inline string_base& assign(const_iterator start)
1252 return assign(start, string_safe_length(start));
1257 inline string_base& assign(const_iterator start, const_iterator end)
1260 return assign(start, end - start);
1265 template < prototype_
character CHARACTER2 >
1266 inline string_base & assign(
const CHARACTER2 * start,
const CHARACTER2 * end);
1269 template < prototype_
character CHARACTER2 >
1270 inline string_base & assign(
const CHARACTER2 * pszSrc, character_count length);
1273 template < prototype_
character CHARACTER2 >
1274 inline string_base & assign(
const CHARACTER2 * pszSrc)
1277 return assign(pszSrc, string_safe_length(pszSrc));
1291 template < prototype_
character SAME_SIZE_CHARACTER >
1292 inline string_base & _assign(
const SAME_SIZE_CHARACTER * pszSrc, character_count length)
1293 requires (
sizeof(SAME_SIZE_CHARACTER) ==
sizeof(CHARACTER));
1295 template < prototype_
character OTHER_SIZE_CHARACTER >
1296 inline string_base & _assign(
const OTHER_SIZE_CHARACTER * pszSrc, character_count length)
1297 requires (
sizeof(OTHER_SIZE_CHARACTER) !=
sizeof(CHARACTER));
1300 template < prototype_
character CHARACTER2 >
1301 inline string_base & assign(CHARACTER2 chSrc, character_count repeat = 1);
1324 inline string_base & append(character_count length, CHARACTER ch);
1325 template < prototype_
character CHARACTER2 >
1326 inline string_base & append_character_array(
const CHARACTER2 * psz, character_count length)
1327 {
auto pszEnd = psz + length;
if(*(pszEnd - 1) == 0) pszEnd--; append(psz, pszEnd - psz); }
1329 inline string_base & append_character(::wd32_character wch);
1330 inline string_base & append_character(::ansi_character ch);
1331 inline string_base & append_character(::wd16_character wch);
1339 inline string_base& append(const ::character_range < ITERATOR_TYPE >& range){ _append(range.m_begin, range.size());
return *
this; }
1342 template <
typename OTHER_CHARACTER >
1343 inline string_base& append(const ::character_range < const OTHER_CHARACTER* >& range)
1344 requires other_primitive_character < OTHER_CHARACTER, CHARACTER >
1345 {_append(range.m_begin, range.size());
return *
this; }
1352 inline string_base& append(ITERATOR_TYPE psz) {
return _append(psz, string_safe_length(psz)); }
1354 template <
typename OTHER_CHARACTER >
1355 inline string_base& append(
const OTHER_CHARACTER * psz)
1356 requires other_primitive_character < OTHER_CHARACTER, CHARACTER >
1357 {
return _append(psz, string_safe_length(psz)); }
1365 inline string_base& append(
const CHARACTER * psz, character_count size) {
return _append(psz, size); }
1367 template <
typename OTHER_CHARACTER >
1368 inline string_base& append(
const OTHER_CHARACTER* psz, character_count size)
1369 requires other_primitive_character < OTHER_CHARACTER, CHARACTER >{
return _append(psz, size); }
1372 inline string_base < ITERATOR_TYPE > & _append(
const CHARACTER * pszSrc, character_count count);
1374 template <
typename OTHER_CHARACTER >
1375 inline string_base < ITERATOR_TYPE >& _append(
const OTHER_CHARACTER * pszSrc, character_count count)
1376 requires other_primitive_character < OTHER_CHARACTER, CHARACTER >;
1397 inline string_base & append(const ::atom & atom);
1398 inline string_base & append(const ::payload & payload);
1399 inline string_base & append(const ::property & property);
1402 inline string_base & concatenate_with_separator(
const SCOPED_STRING & scopedstrSeparator,
const SCOPED_STRING & scopedstr);
1408 if (this->has_string_storage())
1411 ::base_data_defer_release(this->m_pbasedata);
1415 default_construct();
1499 inline auto_string_buffer<ITERATOR_TYPE> auto_release_buffer(character_count characterCount = -1);
1502 template <
bool t_bPreserve = false>
1503 inline CHARACTER * get_buffer(character_count characterCount = -1)
1508 return (CHARACTER*)this->m_begin;
1562 inline mutable_string_range < CHARACTER * > get_range_buffer(character_count characterCount)
1565 auto p = get_buffer(characterCount);
1567 return { p, p + characterCount };
1572 inline void release_range_buffer(
const mutable_string_range < CHARACTER * > & range)
1575 if(range.m_end > (this->m_begin + this->storage_character_count()))
1578 throw_exception(error_invalid_buffer);
1582 ::memory_transfer((CHARACTER *) this->m_begin, range.m_begin, range.size());
1584 release_buffer(range.size());
1610 inline void get_string(CHARACTER * psz)
const noexcept;
1615 inline bool if_empty_set_to(
const string_base & str)
1618 if (!this->is_empty())
1632 inline static string_base empty_string() {
return string_base(); }
1634 string_base & release_buffer(character_count nNewLength = -1);
1637 inline this_iterator truncate_on_find_character(CHARACTER ch);
1639 inline this_iterator & truncate(this_iterator p);
1640 template < prototype_
integral INTEGRAL >
1641 inline this_iterator & truncate(INTEGRAL count) {
return truncate(this->m_begin + count);}
1643 template < prototype_
integral INTEGRAL >
1644 inline this_iterator & rear_truncate(INTEGRAL count)
1647 auto count2 = ::minimum(this->length(), count);
1649 return this->truncate(this->length() - count2);
1655 template < prototype_
integral INTEGRAL >
1656 inline string_base truncated(INTEGRAL count)
const
1659 if (this->length() <= count)
1666 return this->left(count);
1682 inline this_iterator & erase_beginning(this_iterator p);
1684 inline void set_at(character_count iChar, CHARACTER ch);
1701 template <
bool t_bPreserve >
1705 return fork_string< false, t_bPreserve >(character_count);
1718 template <
bool t_bPreserve >
1723 auto old_size = this->size();
1725 auto lengthNew = characterCount < 0 ? old_size + characterCount + 1 : characterCount;
1727 auto pbasedataOld = this->m_pbasedata;
1729 auto pdataOld = this->m_begin;
1733 if (::is_set(pbasedataOld) &&
1734 !pbasedataOld->base_data_is_shared() &&
1735 lengthNew <= pbasedataOld->storage_character_count())
1760 auto pbasedata = this->create_string_data2(lengthNew, this->m_erange);
1762 auto pdata = pbasedata->data();
1767 ASSERT(::is_null(pbasedataOld) || pbasedataOld->m_countReference >= 1);
1771 if (::is_set(pdataOld))
1774 if constexpr (t_bPreserve)
1777 auto sizeCopy = minimum(old_size, lengthNew);
1782 memory_copy((
void*)pdata, pdataOld, sizeCopy *
sizeof(CHARACTER));
1790 if (::is_set(pbasedataOld))
1796 ::base_data_defer_release(pbasedataOld);
1802 this->m_begin = pdata;
1976 const SCOPED_STRING & if_empty(
const SCOPED_STRING & scopedstr)
const {
return this->is_empty() ? scopedstr : *((
const SCOPED_STRING *)
this); }
1977 bool set_if_empty(
const SCOPED_STRING & scopedstr) {
return this->is_empty() ? (*
this = scopedstr,
true) : false; }
1980 void add(CHARACTER ch);
1984 void reserve(character_count res_arg = 0);
1987 string_base& erase_end(character_count start) {
return this->index_erase(start, (::character_count)this->index_of(this->end())); }
1990 string_base& erase_count_end(character_count count) {
return this->index_erase(this->size() - count, count); }
1993 string_base & index_erase(character_count start, character_count count);
1998 string_base & erase(const_iterator start, character_count count) {
return this->index_erase(this->index_of(start), count); }
2000 string_base & erase(const_iterator start, const_iterator end = 0)
2003 if (!end) end = this->end();
2005 return this->index_erase(this->index_of(start), this->index_of(end) - this->index_of(start));
2009 ::collection::count insert(character_count iIndex, CHARACTER ch);
2011 ::collection::count insert(character_count iIndex,
const string_base & str);
2013 ::collection::count replace_with(CHARACTER charNew, CHARACTER charOld, character_count start = 0);
2015 template <
typename EQUALITY >
2016 ::collection::count _replace_with(
const SCOPED_STRING & scopedstrNew,
const SCOPED_STRING & scopedstrOld, character_count start, EQUALITY equality);
2019 ::collection::count replace_with(
const SCOPED_STRING & scopedstrNew,
const SCOPED_STRING & scopedstrOld, character_count start = 0)
2022 return _replace_with(scopedstrNew, scopedstrOld, start, ::comparison::comparison<CHARACTER>());
2027 ::collection::count case_insensitive_replace_with(
const SCOPED_STRING & scopedstrNew,
const SCOPED_STRING & scopedstrOld, character_count start = 0)
2030 return _replace_with(scopedstrNew, scopedstrOld, start, ::comparison::case_insensitive<CHARACTER>());
2034 ::collection::count replace_with_count(
const SCOPED_STRING & scopedstrNew,
const SCOPED_STRING & scopedstrOld, character_count iStart = 0);
2036 ::collection::count replace_with_ci_count(
const SCOPED_STRING & scopedstrNew,
const SCOPED_STRING & scopedstrOld, character_count iStart = 0);
2038 ::collection::count find_replace(CHARACTER charOld, CHARACTER charNew, character_count iStart = 0)
2041 return replace_with(charNew, charOld, iStart);
2045 ::collection::count find_replace(
const SCOPED_STRING & scopedstrOld,
const SCOPED_STRING & scopedstrNew, character_count start = 0)
2048 return _replace_with(scopedstrNew, scopedstrOld, start, comparison::comparison<CHARACTER>());
2053 ::collection::count case_insensitive_find_replace(
const SCOPED_STRING & scopedstrOld,
const SCOPED_STRING & scopedstrNew, character_count start = 0)
2056 return _replace_with(scopedstrNew, scopedstrOld, start, comparison::case_insensitive<CHARACTER>());
2063 ::collection::count find_replace_count(
const SCOPED_STRING & scopedstrOld,
const SCOPED_STRING & scopedstrNew, character_count iStart = 0)
2066 return replace_with_count(scopedstrNew, scopedstrOld, iStart);
2072 ::collection::count case_insensitive_find_replace_count(
const SCOPED_STRING & scopedstrOld,
const SCOPED_STRING & scopedstrNew, character_count iStart = 0)
2075 return replace_with_ci_count(scopedstrNew, scopedstrOld, iStart);
2099 string_base & replace(const_iterator start, const_iterator end,
const SCOPED_STRING & scopedstr);
2100 string_base & replace_index(character_count start, character_count end,
const SCOPED_STRING & scopedstr)
2103 return replace(this->begin() + start, this->begin() + end, scopedstr);
2109 ::collection::count erase_character(CHARACTER chRemove);
2110 ::collection::count erase_any_character_in(
const SCOPED_STRING & scopedstrCharacters);
2112 string_base Tokenize(
const SCOPED_STRING & scopedstrTokens, character_count & iStart)
const;
2115 string_base & begins_eat_any_character_in(
const SCOPED_STRING & scopedstrCharacters = 0)
2118 auto pbegin = this->skip_any_character_in(scopedstrCharacters);
2120 if(pbegin != this->begin())
2123 this->erase_beginning(pbegin);
2143 string_base intersection(
const SCOPED_STRING & scopedstr)
const;
2146 string_base ansistr()
const
2168 unicode_iterator < CHARACTER > unicode_begin()
const
2171 return this->data();
2176 unicode_iterator < CHARACTER > unicode_end()
const
2179 return this->data() + this->size();
2183 template < prototype_
integral START >
2184 string_base unicode_substr(START start)
const
2187 return { (this->unicode_begin() + start).c_str(), this->end()};
2192 template < prototype_
integral START, prototype_
integral COUNT >
2193 string_base unicode_substr(START start, COUNT count)
const
2196 return { (this->unicode_begin() + start).c_str(), (this->unicode_begin() + start + count).c_str()};
2201 constexpr bool starts_with_word(
const SCOPED_STRING& range, const ::get_word_function < ITERATOR_TYPE > & functionGetWord)
const
2204 return functionGetWord(*
this,
nullptr).order(range) == 0;
2210 string_base get_word(
const SCOPED_STRING& sSep)
2213 return ::string_get_word_with_separator_list_and_go_next(*
this, sSep);
2218 const_string_range < ITERATOR_TYPE > _peek_word(
const SCOPED_STRING &sSep, ITERATOR_TYPE * ppnext =
nullptr)
const
2222 return ::string_get_word_with_separator_list((
const SCOPED_STRING &) *
this, sSep, ppnext);
2227 string_base peek_word(
const SCOPED_STRING &sSep, ITERATOR_TYPE *ppnext =
nullptr)
const
2230 return this->_peek_word(sSep, ppnext);
2235 constexpr bool case_insensitive_starts_with_word(
const SCOPED_STRING &range,
2236 const get_word_function<ITERATOR_TYPE> &functionGetWord)
const
2239 return functionGetWord(*
this,
nullptr).case_insensitive_order(range) == 0;
2244 constexpr bool starts_with_word(
const SCOPED_STRING& range)
const
2247 return this->starts_with_word(range, &::string_get_word_separated_by_spaces < ITERATOR_TYPE >);
2252 constexpr bool case_insensitive_starts_with_word(
const SCOPED_STRING& range)
const
2255 return case_insensitive_starts_with_word(range, &::string_get_word_separated_by_spaces < ITERATOR_TYPE >);
2265 inline bool begins_eat(
const SCOPED_STRING & scopedstrPrefix);
2266 inline bool ends_eat(
const SCOPED_STRING & scopedstrSuffix);
2268 inline bool case_insensitive_begins_eat(
const SCOPED_STRING & scopedstrPrefix);
2269 inline bool case_insensitive_ends_eat(
const SCOPED_STRING & scopedstrSuffix);
2271 inline bool begins_erase_get_erased(string_base& strErased,
const SCOPED_STRING& scopedstr);
2272 inline bool ends_erase_get_erased(string_base& strErased,
const SCOPED_STRING& scopedstr);
2274 inline bool begins_replace(
const SCOPED_STRING & scopedstrNewPrefix,
const SCOPED_STRING & scopedstrPrefix);
2276 inline bool case_insensitive_begins_replace(
const SCOPED_STRING & scopedstrNewPrefix,
const SCOPED_STRING & scopedstrPrefix);
2278 inline bool begins_get_remainder(string_base & strRemainder,
const SCOPED_STRING & scopedstr)
const;
2279 inline bool ends_get_remainder(string_base & strRemainder,
const SCOPED_STRING & scopedstr)
const;
2281 inline bool case_insensitive_begins_get_remainder(string_base & strRemainder,
const SCOPED_STRING & scopedstr)
const;
2282 inline bool case_insensitive_ends_get_remainder(string_base & strRemainder,
const SCOPED_STRING & scopedstr)
const;
2284 inline string_base begins_bitten(
const SCOPED_STRING & scopedstr)
const;
2285 inline string_base ends_bitten(
const SCOPED_STRING & scopedstr)
const;
2287 inline string_base case_insensitive_begins_bitten(
const SCOPED_STRING & scopedstr)
const;
2288 inline string_base case_insensitive_ends_bitten(
const SCOPED_STRING & scopedstr)
const;
2290 inline string_base case_insensitive_begins_eaten(
const SCOPED_STRING & scopedstr)
const;
2291 inline string_base case_insensitive_ends_eaten(
const SCOPED_STRING & scopedstr)
const;
2293 inline string_base & ensure_prefix(
const SCOPED_STRING & scopedstrPrefix);
2294 inline string_base & case_insensitive_ensure_prefix(
const SCOPED_STRING & scopedstrPrefix);
2296 inline string_base & ensure_suffix(
const SCOPED_STRING & scopedstrSuffix);
2297 inline string_base & case_insensitive_ensure_suffix(
const SCOPED_STRING & scopedstrSuffix);
2299 inline string_base defer_prefixed(
const SCOPED_STRING & scopedstrPrefix)
const;
2300 inline string_base case_insensitive_defer_prefixed(
const SCOPED_STRING & scopedstrPrefix)
const;
2302 inline string_base defer_suffixed(
const SCOPED_STRING & scopedstrSuffix)
const;
2303 inline string_base case_insensitive_defer_suffixed(
const SCOPED_STRING & scopedstrSuffix)
const;
2323 bool eat_before(string_base & strBefore,
const SCOPED_STRING & strSeparator,
bool bEatEverythingIfNotFound =
false);
2324 bool eat_before_let_separator(string_base & strBefore,
const SCOPED_STRING & strSeparator,
bool bEatEverythingIfNotFound =
false);
2329 string_base & make_upper();
2332 string_base & make_lower();
2335 string_base & MakeReverse();
2337 string_base lower()
const;
2339 string_base upper()
const;
2343 string_base uppered()
const;
2349 string_base reversed()
const;
2354 string_base & trim_right();
2357 string_base & trim_left();
2360 string_base & trim();
2363 string_base & trim(CHARACTER chTarget);
2366 string_base & trim(
const SCOPED_STRING & scopedstrTargets);
2371 string_base & trim_right(CHARACTER chTarget);
2376 string_base &
trim_right(
const SCOPED_STRING & scopedstrTargets);
2379 string_base & trim_left(CHARACTER chTarget);
2384 string_base & trim_left(
const SCOPED_STRING & scopedstrTargets);
2388 string_base right_trimmed()
const;
2391 string_base left_trimmed()
const;
2394 string_base trimmed()
const;
2397 string_base trimmed(CHARACTER chTarget)
const;
2400 string_base trimmed(
const SCOPED_STRING & scopedstrTargets)
const;
2405 string_base right_trimmed(CHARACTER chTarget)
const;
2408 string_base right_trimmed(
const SCOPED_STRING & scopedstrCharacters)
const;
2411 string_base left_trimmed(CHARACTER chTarget)
const;
2414 string_base left_trimmed(
const SCOPED_STRING & strTargets)
const;
2417 bool pair_trim(CHARACTER character1, CHARACTER character2)
2420 if (this->size() >= 2)
2423 if (this->first() == character1 && this->last() == character2)
2426 *
this = this->substr(1, this->length() - 2);
2439 string_base & pair_trim_quotes()
2442 while (pair_trim(
'\"',
'\"') || pair_trim(
'\'',
'\''));
2449 string_base paired_trim_quotes()
2454 str.pair_trim_quotes();
2456 return ::transfer(str);
2475 string_base & formatf(
const CHARACTER * pszFormat, ...);
2477 string_base & formatf_arguments(
const CHARACTER * pszFormat, va_list args);
2479 string_base & format_arguments(
const scoped_string & scopedstrFormat, std::format_args args)
2480 requires(::is_same<CHARACTER, ansi_character>);
2482 string_base & format_arguments(
const scoped_wstring & scopedstrFormat, std::wformat_args args)
2483 requires(::is_same<CHARACTER, wide_character>);
2485 string_base & append_formatf(
const CHARACTER * pszFormat, ...);
2487 string_base & append_formatf_arguments(
const CHARACTER * pszFormat, va_list args);
2495 template<
typename... Args>
2496 string_base & format(::std::format_string<Args...> fmt, Args&&... args)
2499 auto s = std::format(fmt, std::forward<Args>(args)...);
2501 return this->assign(s.c_str(), s.size());
2514 template <
typename... Args>
2515 string_base& append_format(std::format_string<Args...> fmt, Args&&... args)
2518 auto str = std::format(fmt, std::forward<Args>(args)...);
2520 return this->append(str.c_str(), str.size());
2525 template<
typename... Args>
2526 string_base & runtime_format(
const scoped_string & scopedstrFormat, Args&&... args)
2527 requires(::is_same<CHARACTER, ansi_character>);
2529 template<
typename... Args>
2530 string_base & runtime_format(
const scoped_wstring & scopedstrFormat, Args&&... args)
2531 requires(::is_same<CHARACTER, wide_character>);
2583 void resize(character_count n)
2588 void resize(character_count n, CHARACTER c);
2593 string_base unichar_substr(character_count iFirst)
const;
2594 string_base unichar_substr(character_count iFirst, character_count nCount)
const;
2595 string_base unichar_left(character_count nCount)
const;
2596 string_base unichar_mid(character_count iFirst)
const;
2597 string_base unichar_mid(character_count iFirst, character_count nCount)
const;
2609 typedef character_count size_type;