LibreOffice
LibreOffice 7.5 SDK C/C++ API Reference
string.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 /*
21  * This file is part of LibreOffice published API.
22  */
23 
24 #ifndef INCLUDED_RTL_STRING_HXX
25 #define INCLUDED_RTL_STRING_HXX
26 
27 #include "sal/config.h"
28 
29 #include <cassert>
30 #include <cstddef>
31 #include <cstdlib>
32 #include <limits>
33 #include <new>
34 #include <ostream>
35 #include <utility>
36 #include <string.h>
37 
38 #if defined LIBO_INTERNAL_ONLY
39 #include <string_view>
40 #include <type_traits>
41 #endif
42 
43 #include "rtl/textenc.h"
44 #include "rtl/string.h"
45 #include "rtl/stringutils.hxx"
46 
47 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
48 #include "config_global.h"
49 #include "rtl/stringconcat.hxx"
50 #endif
51 
52 #ifdef RTL_STRING_UNITTEST
53 extern bool rtl_string_unittest_const_literal;
54 extern bool rtl_string_unittest_const_literal_function;
55 #endif
56 
57 // The unittest uses slightly different code to help check that the proper
58 // calls are made. The class is put into a different namespace to make
59 // sure the compiler generates a different (if generating also non-inline)
60 // copy of the function and does not merge them together. The class
61 // is "brought" into the proper rtl namespace by a typedef below.
62 #ifdef RTL_STRING_UNITTEST
63 #define rtl rtlunittest
64 #endif
65 
66 namespace rtl
67 {
68 
70 #ifdef RTL_STRING_UNITTEST
71 #undef rtl
72 // helper macro to make functions appear more readable
73 #define RTL_STRING_CONST_FUNCTION rtl_string_unittest_const_literal_function = true;
74 #else
75 #define RTL_STRING_CONST_FUNCTION
76 #endif
77 
79 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
80 
87 template<std::size_t N> class SAL_WARN_UNUSED OStringLiteral {
88  static_assert(N != 0);
89  static_assert(N - 1 <= std::numeric_limits<sal_Int32>::max(), "literal too long");
90  friend class OString;
91  friend class OStringConstExpr;
92 
93 public:
94 #if HAVE_CPP_CONSTEVAL
95  consteval
96 #else
97  constexpr
98 #endif
99  OStringLiteral(char const (&literal)[N]) {
100  assertLayout();
101  assert(literal[N - 1] == '\0');
102  //TODO: Use C++20 constexpr std::copy_n (P0202R3):
103  for (std::size_t i = 0; i != N; ++i) {
104  more.buffer[i] = literal[i];
105  }
106  }
107 
108 #if defined __cpp_char8_t
109 #if HAVE_CPP_CONSTEVAL
110  consteval
111 #else
112  constexpr
113 #endif
114  explicit OStringLiteral(char8_t const (&literal)[N]) {
115  assertLayout();
116  assert(literal[N - 1] == '\0');
117  //TODO: Use C++20 constexpr std::copy_n (P0202R3):
118  for (std::size_t i = 0; i != N; ++i) {
119  more.buffer[i] = literal[i];
120  }
121  }
122 #endif
123 
124  constexpr sal_Int32 getLength() const { return more.length; }
125 
126  constexpr char const * getStr() const SAL_RETURNS_NONNULL { return more.buffer; }
127 
128  constexpr operator std::string_view() const { return {more.buffer, sal_uInt32(more.length)}; }
129 
130 private:
131  static constexpr void assertLayout() {
132  // These static_asserts verifying the layout compatibility with rtl_String cannot be class
133  // member declarations, as offsetof requires a complete type, so defer them to here:
134  static_assert(std::is_standard_layout_v<OStringLiteral>);
135  static_assert(offsetof(OStringLiteral, str.refCount) == offsetof(OStringLiteral, more.refCount));
136  static_assert(offsetof(OStringLiteral, str.length) == offsetof(OStringLiteral, more.length));
137  static_assert(offsetof(OStringLiteral, str.buffer) == offsetof(OStringLiteral, more.buffer));
138  }
139 
140  struct Data {
141  Data() = default;
142 
143  oslInterlockedCount refCount = 0x40000000; // SAL_STRING_STATIC_FLAG (sal/rtl/strimp.hxx)
144  sal_Int32 length = N - 1;
145  char buffer[N] = {}; //TODO: drop initialization for C++20 (P1331R2)
146  };
147 
148  union {
149  rtl_String str;
150  Data more = {};
151  };
152 };
153 
162 class OString;
163 class OStringConstExpr
164 {
165 public:
166  template<std::size_t N> constexpr OStringConstExpr(OStringLiteral<N> const & literal):
167  pData(const_cast<rtl_String *>(&literal.str)) {}
168 
169  // prevent mis-use
170  template<std::size_t N> constexpr OStringConstExpr(OStringLiteral<N> && literal)
171  = delete;
172 
173  // no destructor necessary because we know we are pointing at a compile-time
174  // constant OStringLiteral, which bypasses ref-counting.
175 
179  constexpr std::string_view asView() const { return std::string_view(pData->buffer, pData->length); }
180 
181  inline operator const OString&() const;
182 
183 private:
184  rtl_String* pData;
185 };
186 
187 #endif
188 
189 /* ======================================================================= */
190 
215 class SAL_WARN_UNUSED SAL_DLLPUBLIC_RTTI OString
216 {
217 public:
219  rtl_String * pData;
221 
226  {
227  pData = NULL;
228  rtl_string_new( &pData );
229  }
230 
236  OString( const OString & str )
237  {
238  pData = str.pData;
239  rtl_string_acquire( pData );
240  }
241 
242 #if defined LIBO_INTERNAL_ONLY
243 
249  OString( OString && str ) noexcept
250  {
251  pData = str.pData;
252  str.pData = nullptr;
253  rtl_string_new( &str.pData );
254  }
255 #endif
256 
262  OString( rtl_String * str )
263  {
264  pData = str;
265  rtl_string_acquire( pData );
266  }
267 
275  OString( rtl_String * str, __sal_NoAcquire )
276  {
277  pData = str;
278  }
279 
285  explicit OString( char value )
286  : pData (NULL)
287  {
288  rtl_string_newFromStr_WithLength( &pData, &value, 1 );
289  }
290 
291 #if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST_CONCAT
292  // Catch inadvertent conversions to the above ctor (e.g., from sal_[u]Int8, aka [un]signed
293  // char):
294  OString(int) = delete;
295 #endif
296 
305  template< typename T >
307  {
308  pData = NULL;
309  rtl_string_newFromStr( &pData, value );
310  }
311 
312  template< typename T >
314  {
315  pData = NULL;
316  rtl_string_newFromStr( &pData, value );
317  }
318 
319 #if __cplusplus > 202002L // C++23 P2266R3 "Simpler implicit move"
320  template< typename T >
322  {
323  pData = NULL;
324  rtl_string_newFromStr( &pData, value );
325  }
326 #endif
327 
338  template< typename T >
340  {
341  assert(
343  pData = NULL;
345  rtl_string_new(&pData);
346  } else {
348  &pData,
350  literal),
352  }
353 #ifdef RTL_STRING_UNITTEST
354  rtl_string_unittest_const_literal = true;
355 #endif
356  }
357 
366  OString( const char * value, sal_Int32 length )
367  {
368  pData = NULL;
369  rtl_string_newFromStr_WithLength( &pData, value, length );
370  }
371 
372 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
373 
379  template<std::size_t N> constexpr OString(OStringLiteral<N> const & literal):
380  pData(const_cast<rtl_String *>(&literal.str)) {}
381  template<std::size_t N> OString(OStringLiteral<N> &&) = delete;
383 #endif
384 
385 #if defined LIBO_INTERNAL_ONLY
386  explicit OString(std::string_view sv) {
387  if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max())) {
388  throw std::bad_alloc();
389  }
390  pData = nullptr;
391  rtl_string_newFromStr_WithLength(&pData, sv.data(), sv.size());
392  }
393 #endif
394 
409  OString( const sal_Unicode * value, sal_Int32 length,
410  rtl_TextEncoding encoding,
411  sal_uInt32 convertFlags = OUSTRING_TO_OSTRING_CVTFLAGS )
412  {
413  pData = NULL;
414  rtl_uString2String( &pData, value, length, encoding, convertFlags );
415  if (pData == NULL) {
416  throw std::bad_alloc();
417  }
418  }
419 
420 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
421 
425  template< typename T1, typename T2 >
426  OString( OStringConcat< T1, T2 >&& c )
427  {
428  const sal_Int32 l = c.length();
429  pData = rtl_string_alloc( l );
430  if (l != 0)
431  {
432  char* end = c.addData( pData->buffer );
433  pData->length = l;
434  *end = '\0';
435  }
436  }
437 
442  template< typename T, std::size_t N >
443  OString( StringNumberBase< char, T, N >&& n )
444  : OString( n.buf, n.length )
445  {}
446 #endif
447 
448 #ifdef LIBO_INTERNAL_ONLY
449  OString(std::nullptr_t) = delete;
450 #endif
451 
456  {
457  rtl_string_release( pData );
458  }
459 
460 #if defined LIBO_INTERNAL_ONLY
461 
472  static OString const & unacquired( rtl_String * const * ppHandle )
473  { return * reinterpret_cast< OString const * >( ppHandle ); }
474 #endif
475 
481  OString & operator=( const OString & str )
482  {
483  rtl_string_assign( &pData, str.pData );
484  return *this;
485  }
486 
487 #if defined LIBO_INTERNAL_ONLY
488 
494  OString & operator=( OString && str ) noexcept
495  {
496  rtl_string_release( pData );
497  pData = str.pData;
498  str.pData = nullptr;
499  rtl_string_new( &str.pData );
500  return *this;
501  }
502 #endif
503 
509  template< typename T >
511  {
512  RTL_STRING_CONST_FUNCTION
513  assert(
516  rtl_string_new(&pData);
517  } else {
519  &pData,
521  literal),
523  }
524  return *this;
525  }
526 
532  OString & operator+=( const OString & str )
533 #if defined LIBO_INTERNAL_ONLY
534  &
535 #endif
536  {
537  rtl_string_newConcat( &pData, pData, str.pData );
538  return *this;
539  }
540 #if defined LIBO_INTERNAL_ONLY
541  void operator+=(OString const &) && = delete;
542 #endif
543 
544 #if defined LIBO_INTERNAL_ONLY
546  operator +=(T const & value) & { return operator +=(std::string_view(value)); }
547  template<typename T> typename libreoffice_internal::CharPtrDetector<T, OString &>::Type
548  operator +=(T const &) && = delete;
549 
550  template<typename T>
551  typename libreoffice_internal::NonConstCharArrayDetector<T, OString &>::Type
552  operator +=(T & value) & { return operator +=(std::string_view(value)); }
553  template<typename T>
554  typename libreoffice_internal::NonConstCharArrayDetector<T, OString &>::Type operator +=(T &) &&
555  = delete;
556 
557  template<typename T> typename libreoffice_internal::ConstCharArrayDetector<T, OString &>::Type
558  operator +=(T & literal) & {
559  assert(libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal));
560  return operator +=(
561  std::string_view(
562  libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal),
563  libreoffice_internal::ConstCharArrayDetector<T>::length));
564  }
565  template<typename T> typename libreoffice_internal::ConstCharArrayDetector<T, OString &>::Type
566  operator +=(T &) && = delete;
567 
568  template<std::size_t N> OString & operator +=(OStringLiteral<N> const & literal) &
569  { return operator +=(std::string_view(literal.getStr(), literal.getLength())); }
570  template<std::size_t N> void operator +=(OStringLiteral<N> const &) && = delete;
571 
572  OString & operator +=(std::string_view sv) & {
573  if (sv.empty()) {
574  return *this;
575  }
576  if (sv.size() > sal_uInt32(std::numeric_limits<sal_Int32>::max() - pData->length)) {
577  throw std::bad_alloc();
578  }
579  auto const l = pData->length + sv.size();
580  rtl_string_ensureCapacity(&pData, l);
581  *addDataHelper(pData->buffer + pData->length, sv.data(), sv.size()) = '\0';
582  pData->length = l;
583  return *this;
584  }
585  void operator +=(std::string_view) && = delete;
586 #endif
587 
588 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
589 
593  template< typename T1, typename T2 >
594  OString& operator+=( OStringConcat< T1, T2 >&& c ) & {
595  sal_Int32 l = c.length();
596  if( l == 0 )
597  return *this;
598  l += pData->length;
599  rtl_string_ensureCapacity( &pData, l );
600  char* end = c.addData( pData->buffer + pData->length );
601  *end = '\0';
602  pData->length = l;
603  return *this;
604  }
605  template<typename T1, typename T2> void operator +=(
606  OStringConcat<T1, T2> &&) && = delete;
607 
612  template< typename T, std::size_t N >
613  OString& operator+=( StringNumberBase< char, T, N >&& n ) & {
614  return operator +=(std::string_view(n.buf, n.length));
615  }
616  template<typename T, std::size_t N> void operator +=(
617  StringNumberBase<char, T, N> &&) && = delete;
618 #endif
619 
624  void clear()
625  {
626  rtl_string_new( &pData );
627  }
628 
637  sal_Int32 getLength() const { return pData->length; }
638 
647  bool isEmpty() const
648  {
649  return pData->length == 0;
650  }
651 
663  const char * getStr() const SAL_RETURNS_NONNULL { return pData->buffer; }
664 
674  char operator [](sal_Int32 index) const {
675  // silence spurious -Werror=strict-overflow warnings from GCC 4.8.2
676  assert(index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength()));
677  return getStr()[index];
678  }
679 
692  sal_Int32 compareTo( const OString & str ) const
693  {
694  return rtl_str_compare_WithLength( pData->buffer, pData->length,
695  str.pData->buffer, str.pData->length );
696  }
697 
711  sal_Int32 compareTo( const OString & rObj, sal_Int32 maxLength ) const
712  {
713  return rtl_str_shortenedCompare_WithLength( pData->buffer, pData->length,
714  rObj.pData->buffer, rObj.pData->length, maxLength );
715  }
716 
729  sal_Int32 reverseCompareTo( const OString & str ) const
730  {
731  return rtl_str_reverseCompare_WithLength( pData->buffer, pData->length,
732  str.pData->buffer, str.pData->length );
733  }
734 
746  bool equals( const OString & str ) const
747  {
748  if ( pData->length != str.pData->length )
749  return false;
750  if ( pData == str.pData )
751  return true;
752  return rtl_str_reverseCompare_WithLength( pData->buffer, pData->length,
753  str.pData->buffer, str.pData->length ) == 0;
754  }
755 
770  bool equalsL( const char* value, sal_Int32 length ) const
771  {
772  if ( pData->length != length )
773  return false;
774 
775  return rtl_str_reverseCompare_WithLength( pData->buffer, pData->length,
776  value, length ) == 0;
777  }
778 
793 #if defined LIBO_INTERNAL_ONLY
794  bool equalsIgnoreAsciiCase( std::string_view str ) const
795  {
796  if ( sal_uInt32(pData->length) != str.size() )
797  return false;
798  if ( pData->buffer == str.data() )
799  return true;
800  return rtl_str_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
801  str.data(), str.size() ) == 0;
802  }
803 #else
804  bool equalsIgnoreAsciiCase( const OString & str ) const
805  {
806  if ( pData->length != str.pData->length )
807  return false;
808  if ( pData == str.pData )
809  return true;
810  return rtl_str_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
811  str.pData->buffer, str.pData->length ) == 0;
812  }
813 #endif
814 
836  template< typename T >
838  {
839  return rtl_str_compareIgnoreAsciiCase( pData->buffer, asciiStr ) == 0;
840  }
841 
842  template< typename T >
844  {
845  return rtl_str_compareIgnoreAsciiCase( pData->buffer, asciiStr ) == 0;
846  }
847 
853  template< typename T >
855  {
856  RTL_STRING_CONST_FUNCTION
857  assert(
859  return
860  (pData->length
863  pData->buffer, pData->length,
865  literal),
867  == 0);
868  }
869 
889  bool equalsIgnoreAsciiCaseL( const char * asciiStr, sal_Int32 asciiStrLength ) const
890  {
891  if ( pData->length != asciiStrLength )
892  return false;
893 
894  return rtl_str_compareIgnoreAsciiCase_WithLength( pData->buffer, pData->length,
895  asciiStr, asciiStrLength ) == 0;
896  }
897 
913 #if defined LIBO_INTERNAL_ONLY
914  bool match( std::string_view str, sal_Int32 fromIndex = 0 ) const
915  {
916  return rtl_str_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
917  str.data(), str.size(), str.size() ) == 0;
918  }
919 #else
920  bool match( const OString & str, sal_Int32 fromIndex = 0 ) const
921  {
922  return rtl_str_shortenedCompare_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
923  str.pData->buffer, str.pData->length, str.pData->length ) == 0;
924  }
925 #endif
926 
932  template< typename T >
933  typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type match( T& literal, sal_Int32 fromIndex = 0 ) const
934  {
935  RTL_STRING_CONST_FUNCTION
936  assert(
938  return
940  pData->buffer + fromIndex, pData->length - fromIndex,
942  literal),
945  == 0;
946  }
947 
964  bool matchL(
965  char const * str, sal_Int32 strLength, sal_Int32 fromIndex = 0)
966  const
967  {
969  pData->buffer + fromIndex, pData->length - fromIndex,
970  str, strLength, strLength) == 0;
971  }
972 
973  // This overload is left undefined, to detect calls of matchL that
974  // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
975  // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
976  // platforms):
977 #if SAL_TYPES_SIZEOFLONG == 8
978  void matchL(char const *, sal_Int32, rtl_TextEncoding) const;
979 #endif
980 
999 #if defined LIBO_INTERNAL_ONLY
1000  bool matchIgnoreAsciiCase( std::string_view str, sal_Int32 fromIndex = 0 ) const
1001  {
1002  return rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
1003  str.data(), str.size(),
1004  str.size() ) == 0;
1005  }
1006 #else
1007  bool matchIgnoreAsciiCase( const OString & str, sal_Int32 fromIndex = 0 ) const
1008  {
1009  return rtl_str_shortenedCompareIgnoreAsciiCase_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
1010  str.pData->buffer, str.pData->length,
1011  str.pData->length ) == 0;
1012  }
1013 #endif
1014 
1019  template< typename T >
1020  typename libreoffice_internal::ConstCharArrayDetector< T, bool >::Type matchIgnoreAsciiCase( T& literal, sal_Int32 fromIndex = 0 ) const
1021  {
1022  RTL_STRING_CONST_FUNCTION
1023  assert(
1025  return
1027  pData->buffer+fromIndex, pData->length-fromIndex,
1029  literal),
1032  == 0;
1033  }
1034 
1049 #if defined LIBO_INTERNAL_ONLY
1050  bool startsWith(std::string_view str, OString * rest = NULL) const {
1051  bool b = match(str);
1052  if (b && rest != NULL) {
1053  *rest = copy(str.size());
1054  }
1055  return b;
1056  }
1057 #else
1058  bool startsWith(OString const & str, OString * rest = NULL) const {
1059  bool b = match(str);
1060  if (b && rest != NULL) {
1061  *rest = copy(str.getLength());
1062  }
1063  return b;
1064  }
1065 #endif
1066 
1072  template< typename T >
1074  T & literal, OString * rest = NULL) const
1075  {
1076  RTL_STRING_CONST_FUNCTION
1077  bool b = match(literal, 0);
1078  if (b && rest != NULL) {
1079  *rest = copy(
1081  }
1082  return b;
1083  }
1084 
1104 #if defined LIBO_INTERNAL_ONLY
1105  bool startsWithIgnoreAsciiCase(std::string_view str, OString * rest = NULL)
1106  const
1107  {
1108  bool b = matchIgnoreAsciiCase(str);
1109  if (b && rest != NULL) {
1110  *rest = copy(str.size());
1111  }
1112  return b;
1113  }
1114 #else
1115  bool startsWithIgnoreAsciiCase(OString const & str, OString * rest = NULL)
1116  const
1117  {
1118  bool b = matchIgnoreAsciiCase(str);
1119  if (b && rest != NULL) {
1120  *rest = copy(str.getLength());
1121  }
1122  return b;
1123  }
1124 #endif
1125 
1131  template< typename T >
1133  startsWithIgnoreAsciiCase(T & literal, OString * rest = NULL) const
1134  {
1135  RTL_STRING_CONST_FUNCTION
1136  assert(
1138  bool b = matchIgnoreAsciiCase(literal);
1139  if (b && rest != NULL) {
1140  *rest = copy(
1142  }
1143  return b;
1144  }
1145 
1160 #if defined LIBO_INTERNAL_ONLY
1161  bool endsWith(std::string_view str, OString * rest = NULL) const {
1162  bool b = str.size() <= sal_uInt32(getLength())
1163  && match(str, getLength() - str.size());
1164  if (b && rest != NULL) {
1165  *rest = copy(0, getLength() - str.size());
1166  }
1167  return b;
1168  }
1169 #else
1170  bool endsWith(OString const & str, OString * rest = NULL) const {
1171  bool b = str.getLength() <= getLength()
1172  && match(str, getLength() - str.getLength());
1173  if (b && rest != NULL) {
1174  *rest = copy(0, getLength() - str.getLength());
1175  }
1176  return b;
1177  }
1178 #endif
1179 
1185  template< typename T >
1187  T & literal, OString * rest = NULL) const
1188  {
1189  RTL_STRING_CONST_FUNCTION
1190  assert(
1192  bool b
1194  <= sal_uInt32(getLength()))
1195  && match(
1197  literal),
1198  (getLength()
1200  if (b && rest != NULL) {
1201  *rest = copy(
1202  0,
1203  (getLength()
1205  }
1206  return b;
1207  }
1208 
1222  bool endsWithL(char const * str, sal_Int32 strLength) const {
1223  return strLength <= getLength()
1224  && matchL(str, strLength, getLength() - strLength);
1225  }
1226 
1227  friend bool operator == ( const OString& rStr1, const OString& rStr2 )
1228  { return rStr1.equals(rStr2); }
1229  friend bool operator != ( const OString& rStr1, const OString& rStr2 )
1230  { return !(operator == ( rStr1, rStr2 )); }
1231  friend bool operator < ( const OString& rStr1, const OString& rStr2 )
1232  { return rStr1.compareTo( rStr2 ) < 0; }
1233  friend bool operator > ( const OString& rStr1, const OString& rStr2 )
1234  { return rStr1.compareTo( rStr2 ) > 0; }
1235  friend bool operator <= ( const OString& rStr1, const OString& rStr2 )
1236  { return rStr1.compareTo( rStr2 ) <= 0; }
1237  friend bool operator >= ( const OString& rStr1, const OString& rStr2 )
1238  { return rStr1.compareTo( rStr2 ) >= 0; }
1239 
1240  template< typename T >
1241  friend typename libreoffice_internal::CharPtrDetector< T, bool >::Type operator==( const OString& rStr1, const T& value )
1242  {
1243  return
1245  rStr1.getStr(), rStr1.getLength(), value, rtl_str_getLength(value))
1246  == 0;
1247  }
1248 
1249  template< typename T >
1251  {
1252  return
1254  rStr1.getStr(), rStr1.getLength(), value, rtl_str_getLength(value))
1255  == 0;
1256  }
1257 
1258  template< typename T >
1259  friend typename libreoffice_internal::CharPtrDetector< T, bool >::Type operator==( const T& value, const OString& rStr2 )
1260  {
1261  return
1263  value, rtl_str_getLength(value), rStr2.getStr(), rStr2.getLength())
1264  == 0;
1265  }
1266 
1267  template< typename T >
1269  {
1270  return
1272  value, rtl_str_getLength(value), rStr2.getStr(), rStr2.getLength())
1273  == 0;
1274  }
1275 
1281  template< typename T >
1283  {
1284  RTL_STRING_CONST_FUNCTION
1285  assert(
1287  return
1288  (rStr.getLength()
1291  rStr.pData->buffer, rStr.pData->length,
1293  literal),
1295  == 0);
1296  }
1297 
1303  template< typename T >
1305  {
1306  RTL_STRING_CONST_FUNCTION
1307  assert(
1309  return
1310  (rStr.getLength()
1313  rStr.pData->buffer, rStr.pData->length,
1315  literal),
1317  == 0);
1318  }
1319 
1320  template< typename T >
1321  friend typename libreoffice_internal::CharPtrDetector< T, bool >::Type operator!=( const OString& rStr1, const T& value )
1322  {
1323  return !(operator == ( rStr1, value ));
1324  }
1325 
1326  template< typename T >
1328  {
1329  return !(operator == ( rStr1, value ));
1330  }
1331 
1332  template< typename T >
1333  friend typename libreoffice_internal::CharPtrDetector< T, bool >::Type operator!=( const T& value, const OString& rStr2 )
1334  {
1335  return !(operator == ( value, rStr2 ));
1336  }
1337 
1338  template< typename T >
1340  {
1341  return !(operator == ( value, rStr2 ));
1342  }
1343 
1349  template< typename T >
1351  {
1352  return !( rStr == literal );
1353  }
1354 
1360  template< typename T >
1362  {
1363  return !( literal == rStr );
1364  }
1365 
1373  sal_Int32 hashCode() const
1374  {
1375  return rtl_str_hashCode_WithLength( pData->buffer, pData->length );
1376  }
1377 
1391  sal_Int32 indexOf( char ch, sal_Int32 fromIndex = 0 ) const
1392  {
1393  sal_Int32 ret = rtl_str_indexOfChar_WithLength( pData->buffer+fromIndex, pData->length-fromIndex, ch );
1394  return (ret < 0 ? ret : ret+fromIndex);
1395  }
1396 
1406  sal_Int32 lastIndexOf( char ch ) const
1407  {
1408  return rtl_str_lastIndexOfChar_WithLength( pData->buffer, pData->length, ch );
1409  }
1410 
1423  sal_Int32 lastIndexOf( char ch, sal_Int32 fromIndex ) const
1424  {
1425  return rtl_str_lastIndexOfChar_WithLength( pData->buffer, fromIndex, ch );
1426  }
1427 
1443 #if defined LIBO_INTERNAL_ONLY
1444  sal_Int32 indexOf( std::string_view str, sal_Int32 fromIndex = 0 ) const
1445  {
1446  sal_Int32 ret = rtl_str_indexOfStr_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
1447  str.data(), str.size() );
1448  return (ret < 0 ? ret : ret+fromIndex);
1449  }
1450 #else
1451  sal_Int32 indexOf( const OString & str, sal_Int32 fromIndex = 0 ) const
1452  {
1453  sal_Int32 ret = rtl_str_indexOfStr_WithLength( pData->buffer+fromIndex, pData->length-fromIndex,
1454  str.pData->buffer, str.pData->length );
1455  return (ret < 0 ? ret : ret+fromIndex);
1456  }
1457 #endif
1458 
1463  template< typename T >
1464  typename libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type indexOf( T& literal, sal_Int32 fromIndex = 0 ) const
1465  {
1466  RTL_STRING_CONST_FUNCTION
1467  assert(
1469  sal_Int32 n = rtl_str_indexOfStr_WithLength(
1470  pData->buffer + fromIndex, pData->length - fromIndex,
1473  return n < 0 ? n : n + fromIndex;
1474  }
1475 
1494  sal_Int32 indexOfL(char const * str, sal_Int32 len, sal_Int32 fromIndex = 0)
1495  const
1496  {
1497  sal_Int32 n = rtl_str_indexOfStr_WithLength(
1498  pData->buffer + fromIndex, pData->length - fromIndex, str, len);
1499  return n < 0 ? n : n + fromIndex;
1500  }
1501 
1502  // This overload is left undefined, to detect calls of indexOfL that
1503  // erroneously use RTL_CONSTASCII_USTRINGPARAM instead of
1504  // RTL_CONSTASCII_STRINGPARAM (but would lead to ambiguities on 32 bit
1505  // platforms):
1506 #if SAL_TYPES_SIZEOFLONG == 8
1507  void indexOfL(char const *, sal_Int32, rtl_TextEncoding) const;
1508 #endif
1509 
1525 #if defined LIBO_INTERNAL_ONLY
1526  sal_Int32 lastIndexOf( std::string_view str ) const
1527  {
1528  return rtl_str_lastIndexOfStr_WithLength( pData->buffer, pData->length,
1529  str.data(), str.size() );
1530  }
1531 #else
1532  sal_Int32 lastIndexOf( const OString & str ) const
1533  {
1534  return rtl_str_lastIndexOfStr_WithLength( pData->buffer, pData->length,
1535  str.pData->buffer, str.pData->length );
1536  }
1537 #endif
1538 
1556 #if defined LIBO_INTERNAL_ONLY
1557  sal_Int32 lastIndexOf( std::string_view str, sal_Int32 fromIndex ) const
1558  {
1559  return rtl_str_lastIndexOfStr_WithLength( pData->buffer, fromIndex,
1560  str.data(), str.size() );
1561  }
1562 #else
1563  sal_Int32 lastIndexOf( const OString & str, sal_Int32 fromIndex ) const
1564  {
1565  return rtl_str_lastIndexOfStr_WithLength( pData->buffer, fromIndex,
1566  str.pData->buffer, str.pData->length );
1567  }
1568 #endif
1569 
1580  SAL_WARN_UNUSED_RESULT OString copy( sal_Int32 beginIndex ) const
1581  {
1582  return copy(beginIndex, getLength() - beginIndex);
1583  }
1584 
1597  SAL_WARN_UNUSED_RESULT OString copy( sal_Int32 beginIndex, sal_Int32 count ) const
1598  {
1599  rtl_String *pNew = NULL;
1600  rtl_string_newFromSubString( &pNew, pData, beginIndex, count );
1601  return OString( pNew, SAL_NO_ACQUIRE );
1602  }
1603 
1604 #if defined LIBO_INTERNAL_ONLY
1605 
1615  SAL_WARN_UNUSED_RESULT std::string_view subView( sal_Int32 beginIndex ) const
1616  {
1617  assert(beginIndex >= 0);
1618  assert(beginIndex <= getLength());
1619  return subView(beginIndex, getLength() - beginIndex);
1620  }
1621 
1634  SAL_WARN_UNUSED_RESULT std::string_view subView( sal_Int32 beginIndex, sal_Int32 count ) const
1635  {
1636  assert(beginIndex >= 0);
1637  assert(count >= 0);
1638  assert(beginIndex <= getLength());
1639  assert(count <= getLength() - beginIndex);
1640  return std::string_view(*this).substr(beginIndex, count);
1641  }
1642 #endif
1643 
1644 #ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
1645 
1654  {
1655  rtl_String* pNew = NULL;
1656  rtl_string_newConcat( &pNew, pData, str.pData );
1657  return OString( pNew, SAL_NO_ACQUIRE );
1658  }
1659 #endif
1660 
1661 #ifndef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
1662  friend OString operator+( const OString & str1, const OString & str2 )
1663  {
1664  return str1.concat( str2 );
1665  }
1666 #endif
1667 
1668 // hide this from internal code to avoid ambiguous lookup error
1669 #ifndef LIBO_INTERNAL_ONLY
1670 
1683  SAL_WARN_UNUSED_RESULT OString replaceAt( sal_Int32 index, sal_Int32 count, const OString& newStr ) const
1684  {
1685  rtl_String* pNew = NULL;
1686  rtl_string_newReplaceStrAt( &pNew, pData, index, count, newStr.pData );
1687  return OString( pNew, SAL_NO_ACQUIRE );
1688  }
1689 #endif
1690 
1691 #ifdef LIBO_INTERNAL_ONLY
1692  SAL_WARN_UNUSED_RESULT OString replaceAt( sal_Int32 index, sal_Int32 count, std::string_view newStr ) const
1693  {
1694  rtl_String* pNew = NULL;
1695  rtl_string_newReplaceStrAt_WithLength ( &pNew, pData, index, count, newStr.data(), newStr.size() );
1696  return OString( pNew, SAL_NO_ACQUIRE );
1697  }
1698 #endif
1699 
1713  SAL_WARN_UNUSED_RESULT OString replace( char oldChar, char newChar ) const
1714  {
1715  rtl_String* pNew = NULL;
1716  rtl_string_newReplace( &pNew, pData, oldChar, newChar );
1717  return OString( pNew, SAL_NO_ACQUIRE );
1718  }
1719 
1739  OString const & from, OString const & to, sal_Int32 * index = NULL) const
1740  {
1741  rtl_String * s = NULL;
1742  sal_Int32 i = 0;
1744  &s, pData, from.pData->buffer, from.pData->length,
1745  to.pData->buffer, to.pData->length, index == NULL ? &i : index);
1746  return OString(s, SAL_NO_ACQUIRE);
1747  }
1748 
1762  SAL_WARN_UNUSED_RESULT OString replaceAll(OString const & from, OString const & to) const {
1763  rtl_String * s = NULL;
1765  &s, pData, from.pData->buffer, from.pData->length,
1766  to.pData->buffer, to.pData->length);
1767  return OString(s, SAL_NO_ACQUIRE);
1768  }
1769 
1781  {
1782  rtl_String* pNew = NULL;
1783  rtl_string_newToAsciiLowerCase( &pNew, pData );
1784  return OString( pNew, SAL_NO_ACQUIRE );
1785  }
1786 
1798  {
1799  rtl_String* pNew = NULL;
1800  rtl_string_newToAsciiUpperCase( &pNew, pData );
1801  return OString( pNew, SAL_NO_ACQUIRE );
1802  }
1803 
1816  {
1817  rtl_String* pNew = NULL;
1818  rtl_string_newTrim( &pNew, pData );
1819  return OString( pNew, SAL_NO_ACQUIRE );
1820  }
1821 
1846  OString getToken( sal_Int32 token, char cTok, sal_Int32& index ) const
1847  {
1848  rtl_String * pNew = NULL;
1849  index = rtl_string_getToken( &pNew, pData, token, cTok, index );
1850  return OString( pNew, SAL_NO_ACQUIRE );
1851  }
1852 
1866  OString getToken(sal_Int32 count, char separator) const {
1867  sal_Int32 n = 0;
1868  return getToken(count, separator, n);
1869  }
1870 
1879  bool toBoolean() const
1880  {
1881  return rtl_str_toBoolean( pData->buffer );
1882  }
1883 
1890  char toChar() const
1891  {
1892  return pData->buffer[0];
1893  }
1894 
1905  sal_Int32 toInt32( sal_Int16 radix = 10 ) const
1906  {
1907  return rtl_str_toInt32( pData->buffer, radix );
1908  }
1909 
1922  sal_uInt32 toUInt32( sal_Int16 radix = 10 ) const
1923  {
1924  return rtl_str_toUInt32( pData->buffer, radix );
1925  }
1926 
1937  sal_Int64 toInt64( sal_Int16 radix = 10 ) const
1938  {
1939  return rtl_str_toInt64( pData->buffer, radix );
1940  }
1941 
1954  sal_uInt64 toUInt64( sal_Int16 radix = 10 ) const
1955  {
1956  return rtl_str_toUInt64( pData->buffer, radix );
1957  }
1958 
1967  float toFloat() const
1968  {
1969  return rtl_str_toFloat( pData->buffer );
1970  }
1971 
1980  double toDouble() const
1981  {
1982  return rtl_str_toDouble( pData->buffer );
1983  }
1984 
1985 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
1986 
1987  static OStringNumber< int > number( int i, sal_Int16 radix = 10 )
1988  {
1989  return OStringNumber< int >( i, radix );
1990  }
1991  static OStringNumber< long long > number( long long ll, sal_Int16 radix = 10 )
1992  {
1993  return OStringNumber< long long >( ll, radix );
1994  }
1995  static OStringNumber< unsigned long long > number( unsigned long long ll, sal_Int16 radix = 10 )
1996  {
1997  return OStringNumber< unsigned long long >( ll, radix );
1998  }
1999  static OStringNumber< unsigned long long > number( unsigned int i, sal_Int16 radix = 10 )
2000  {
2001  return number( static_cast< unsigned long long >( i ), radix );
2002  }
2003  static OStringNumber< long long > number( long i, sal_Int16 radix = 10)
2004  {
2005  return number( static_cast< long long >( i ), radix );
2006  }
2007  static OStringNumber< unsigned long long > number( unsigned long i, sal_Int16 radix = 10 )
2008  {
2009  return number( static_cast< unsigned long long >( i ), radix );
2010  }
2011  static OStringNumber< float > number( float f )
2012  {
2013  return OStringNumber< float >( f );
2014  }
2015  static OStringNumber< double > number( double d )
2016  {
2017  return OStringNumber< double >( d );
2018  }
2019 #else
2020 
2030  static OString number( int i, sal_Int16 radix = 10 )
2031  {
2032  char aBuf[RTL_STR_MAX_VALUEOFINT32];
2033  return OString(aBuf, rtl_str_valueOfInt32(aBuf, i, radix));
2034  }
2037  static OString number( unsigned int i, sal_Int16 radix = 10 )
2038  {
2039  return number( static_cast< unsigned long long >( i ), radix );
2040  }
2043  static OString number( long i, sal_Int16 radix = 10 )
2044  {
2045  return number( static_cast< long long >( i ), radix );
2046  }
2049  static OString number( unsigned long i, sal_Int16 radix = 10 )
2050  {
2051  return number( static_cast< unsigned long long >( i ), radix );
2052  }
2055  static OString number( long long ll, sal_Int16 radix = 10 )
2056  {
2057  char aBuf[RTL_STR_MAX_VALUEOFINT64];
2058  return OString(aBuf, rtl_str_valueOfInt64(aBuf, ll, radix));
2059  }
2062  static OString number( unsigned long long ll, sal_Int16 radix = 10 )
2063  {
2064  char aBuf[RTL_STR_MAX_VALUEOFUINT64];
2065  return OString(aBuf, rtl_str_valueOfUInt64(aBuf, ll, radix));
2066  }
2067 
2077  static OString number( float f )
2078  {
2079  char aBuf[RTL_STR_MAX_VALUEOFFLOAT];
2080  return OString(aBuf, rtl_str_valueOfFloat(aBuf, f));
2081  }
2082 
2092  static OString number( double d )
2093  {
2094  char aBuf[RTL_STR_MAX_VALUEOFDOUBLE];
2095  return OString(aBuf, rtl_str_valueOfDouble(aBuf, d));
2096  }
2097 #endif
2098 
2110  SAL_DEPRECATED("use boolean()") static OString valueOf( sal_Bool b )
2111  {
2112  return boolean(b);
2113  }
2114 
2126  static OString boolean( bool b )
2127  {
2128  char aBuf[RTL_STR_MAX_VALUEOFBOOLEAN];
2129  return OString(aBuf, rtl_str_valueOfBoolean(aBuf, b));
2130  }
2131 
2139  SAL_DEPRECATED("convert to OString or use directly") static OString valueOf( char c )
2140  {
2141  return OString( &c, 1 );
2142  }
2143 
2154  SAL_DEPRECATED("use number()") static OString valueOf( sal_Int32 i, sal_Int16 radix = 10 )
2155  {
2156  return number( i, radix );
2157  }
2158 
2169  SAL_DEPRECATED("use number()") static OString valueOf( sal_Int64 ll, sal_Int16 radix = 10 )
2170  {
2171  return number( ll, radix );
2172  }
2173 
2183  SAL_DEPRECATED("use number()") static OString valueOf( float f )
2184  {
2185  return number(f);
2186  }
2187 
2197  SAL_DEPRECATED("use number()") static OString valueOf( double d )
2198  {
2199  return number(d);
2200  }
2201 
2202 #if defined LIBO_INTERNAL_ONLY
2203  operator std::string_view() const { return {getStr(), sal_uInt32(getLength())}; }
2204 #endif
2205 
2206 #if defined LIBO_INTERNAL_ONLY
2207  // A wrapper for the first expression in an
2208  //
2209  // OString::Concat(e1) + e2 + ...
2210  //
2211  // concatenation chain, when neither of the first two e1, e2 is one of our rtl string-related
2212  // classes (so something like
2213  //
2214  // OString s = "a" + (b ? std::string_view("c") : std::string_view("dd"));
2215  //
2216  // would not compile):
2217  template<typename T> [[nodiscard]] static
2218  OStringConcat<OStringConcatMarker, T>
2219  Concat(T const & value) { return OStringConcat<OStringConcatMarker, T>({}, value); }
2220 
2221  // This overload is needed so that an argument of type 'char const[N]' ends up as
2222  // 'OStringConcat<rtl::OStringConcatMarker, char const[N]>' rather than as
2223  // 'OStringConcat<rtl::OStringConcatMarker, char[N]>':
2224  template<typename T, std::size_t N> [[nodiscard]] static
2225  OStringConcat<OStringConcatMarker, T[N]>
2226  Concat(T (& value)[N]) { return OStringConcat<OStringConcatMarker, T[N]>({}, value); }
2227 #endif
2228 };
2229 
2230 #if defined LIBO_INTERNAL_ONLY
2231 // Can only define this after we define OString
2232 inline OStringConstExpr::operator const OString &() const { return OString::unacquired(&pData); }
2233 #endif
2234 
2235 #if defined LIBO_INTERNAL_ONLY
2236 inline bool operator ==(OString const & lhs, StringConcatenation<char> const & rhs)
2237 { return lhs == std::string_view(rhs); }
2238 inline bool operator !=(OString const & lhs, StringConcatenation<char> const & rhs)
2239 { return lhs != std::string_view(rhs); }
2240 inline bool operator ==(StringConcatenation<char> const & lhs, OString const & rhs)
2241 { return std::string_view(lhs) == rhs; }
2242 inline bool operator !=(StringConcatenation<char> const & lhs, OString const & rhs)
2243 { return std::string_view(lhs) != rhs; }
2244 #endif
2245 
2246 /* ======================================================================= */
2247 
2248 #ifdef LIBO_INTERNAL_ONLY // "RTL_FAST_STRING"
2249 
2253 template<>
2254 struct ToStringHelper< OString >
2255 {
2256  static std::size_t length( const OString& s ) { return s.getLength(); }
2257  char* operator()( char* buffer, const OString& s ) const { return addDataHelper( buffer, s.getStr(), s.getLength()); }
2258 };
2259 
2263 template<std::size_t N>
2264 struct ToStringHelper< OStringLiteral<N> >
2265 {
2266  static constexpr std::size_t length( const OStringLiteral<N>& str ) { return str.getLength(); }
2267  char* operator()( char* buffer, const OStringLiteral<N>& str ) const { return addDataHelper( buffer, str.getStr(), str.getLength() ); }
2268 };
2269 
2273 template< typename charT, typename traits, typename T1, typename T2 >
2274 inline std::basic_ostream<charT, traits> & operator <<(
2275  std::basic_ostream<charT, traits> & stream, OStringConcat< T1, T2 >&& concat)
2276 {
2277  return stream << OString( std::move(concat) );
2278 }
2279 #endif
2280 
2281 
2288 {
2298  size_t operator()( const OString& rString ) const
2299  { return static_cast<size_t>(rString.hashCode()); }
2300 };
2301 
2304 {
2305  bool operator()( const char* p1, const char* p2) const
2306  { return rtl_str_compare(p1, p2) == 0; }
2307 };
2308 
2311 {
2312  size_t operator()(const char* p) const
2313  { return rtl_str_hashCode(p); }
2314 };
2315 
2316 /* ======================================================================= */
2317 
2324 template< typename charT, typename traits > std::basic_ostream<charT, traits> &
2326  std::basic_ostream<charT, traits> & stream, OString const & rString)
2327 {
2328  return stream << rString.getStr();
2329  // best effort; potentially loses data due to embedded null characters
2330 }
2331 
2332 } /* Namespace */
2333 
2334 #ifdef RTL_STRING_UNITTEST
2335 namespace rtl
2336 {
2337 typedef rtlunittest::OString OString;
2338 }
2339 #undef RTL_STRING_CONST_FUNCTION
2340 #endif
2341 
2342 #if defined LIBO_INTERNAL_ONLY && !defined RTL_STRING_UNITTEST
2343 using ::rtl::OString;
2344 using ::rtl::OStringChar;
2345 using ::rtl::Concat2View;
2346 using ::rtl::OStringHash;
2347 using ::rtl::OStringLiteral;
2348 #endif
2349 
2351 
2356 #if defined LIBO_INTERNAL_ONLY
2357 namespace std {
2358 
2359 template<>
2360 struct hash<::rtl::OString>
2361 {
2362  std::size_t operator()(::rtl::OString const & s) const
2363  {
2364  if constexpr (sizeof(std::size_t) == 8)
2365  {
2366  // return a hash that uses the full 64-bit range instead of a 32-bit value
2367  size_t n = 0;
2368  for (sal_Int32 i = 0, len = s.getLength(); i < len; ++i)
2369  n = 31 * n + s[i];
2370  return n;
2371  }
2372  else
2373  return std::size_t(s.hashCode());
2374  }
2375 };
2376 
2377 }
2378 
2379 #endif
2380 
2382 #endif // INCLUDED_RTL_STRING_HXX
2383 
2384 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
double toDouble() const
Returns the double value from this string.
Definition: string.hxx:1980
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type equalsIgnoreAsciiCase(T &literal) const
This is an overloaded member function, provided for convenience. It differs from the above function ...
Definition: string.hxx:854
#define OUSTRING_TO_OSTRING_CVTFLAGS
Definition: string.h:1358
friend libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=(const OString &rStr, T &literal)
This is an overloaded member function, provided for convenience. It differs from the above function ...
Definition: string.hxx:1350
sal_Int32 getLength() const
Returns the length of this string.
Definition: string.hxx:637
size_t operator()(const char *p) const
Definition: string.hxx:2312
~OString()
Release the string data.
Definition: string.hxx:455
sal_Int64 toInt64(sal_Int16 radix=10) const
Returns the int64 value from this string.
Definition: string.hxx:1937
SAL_DLLPUBLIC sal_Int32 rtl_str_reverseCompare_WithLength(const char *first, sal_Int32 firstLen, const char *second, sal_Int32 secondLen) SAL_THROW_EXTERN_C()
Compare two strings from back to front.
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfFloat(char *str, float f) SAL_THROW_EXTERN_C()
Create the string representation of a float.
#define RTL_STR_MAX_VALUEOFINT32
Definition: string.h:631
libreoffice_internal::ConstCharArrayDetector< T, OString &>::Type operator=(T &literal)
This is an overloaded member function, provided for convenience. It differs from the above function ...
Definition: string.hxx:510
static OString number(unsigned long i, sal_Int16 radix=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:2049
bool equals(const OString &str) const
Perform a comparison of two strings.
Definition: string.hxx:746
OString(T &value, typename libreoffice_internal::NonConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy())
Definition: string.hxx:313
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfUInt64(char *str, sal_uInt64 l, sal_Int16 radix) SAL_THROW_EXTERN_C()
Create the string representation of an unsigned long integer.
SAL_DLLPUBLIC sal_Int32 rtl_str_indexOfStr_WithLength(const char *str, sal_Int32 len, const char *subStr, sal_Int32 subLen) SAL_THROW_EXTERN_C()
Search for the first occurrence of a substring within a string.
sal_Int32 indexOf(const OString &str, sal_Int32 fromIndex=0) const
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
Definition: string.hxx:1451
friend libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==(const OString &rStr, T &literal)
This is an overloaded member function, provided for convenience. It differs from the above function ...
Definition: string.hxx:1282
SAL_WARN_UNUSED_RESULT OString copy(sal_Int32 beginIndex, sal_Int32 count) const
Returns a new string that is a substring of this string.
Definition: string.hxx:1597
SAL_DLLPUBLIC sal_Int32 rtl_str_compareIgnoreAsciiCase(const char *first, const char *second) SAL_THROW_EXTERN_C()
Compare two strings, ignoring the case of ASCII characters.
#define RTL_STR_MAX_VALUEOFFLOAT
Definition: string.h:696
SAL_DLLPUBLIC sal_uInt32 rtl_str_toUInt32(const char *str, sal_Int16 radix) SAL_THROW_EXTERN_C()
Interpret a string as an unsigned integer.
#define RTL_STR_MAX_VALUEOFUINT64
Definition: string.h:677
OString(const OString &str)
New string from OString.
Definition: string.hxx:236
sal_Int32 lastIndexOf(const OString &str, sal_Int32 fromIndex) const
Returns the index within this string of the last occurrence of the specified substring, searching backward starting before the specified index.
Definition: string.hxx:1563
SAL_WARN_UNUSED_RESULT OString toAsciiUpperCase() const
Converts from this string all ASCII lowercase characters (97-122) to ASCII uppercase characters (65-9...
Definition: string.hxx:1797
#define RTL_STR_MAX_VALUEOFINT64
Definition: string.h:654
SAL_DLLPUBLIC sal_Int32 rtl_str_shortenedCompare_WithLength(const char *first, sal_Int32 firstLen, const char *second, sal_Int32 secondLen, sal_Int32 shortenedLen) SAL_THROW_EXTERN_C()
Compare two strings with a maximum count of characters.
bool equalsL(const char *value, sal_Int32 length) const
Perform a comparison of two strings.
Definition: string.hxx:770
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWith(T &literal, OString *rest=NULL) const
This is an overloaded member function, provided for convenience. It differs from the above function ...
Definition: string.hxx:1073
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &stream, OString const &rString)
Support for rtl::OString in std::ostream (and thus in CPPUNIT_ASSERT or SAL_INFO macros, for example).
Definition: string.hxx:2325
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfBoolean(char *str, sal_Bool b) SAL_THROW_EXTERN_C()
Create the string representation of a boolean.
const char * getStr() const SAL_RETURNS_NONNULL
Returns a pointer to the characters of this string.
Definition: string.hxx:663
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type matchIgnoreAsciiCase(T &literal, sal_Int32 fromIndex=0) const
This is an overloaded member function, provided for convenience. It differs from the above function ...
Definition: string.hxx:1020
OString(const sal_Unicode *value, sal_Int32 length, rtl_TextEncoding encoding, sal_uInt32 convertFlags=OUSTRING_TO_OSTRING_CVTFLAGS)
New string from a Unicode character buffer array.
Definition: string.hxx:409
OString getToken(sal_Int32 count, char separator) const
Returns a token from the string.
Definition: string.hxx:1866
OString getToken(sal_Int32 token, char cTok, sal_Int32 &index) const
Returns a token in the string.
Definition: string.hxx:1846
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfInt32(char *str, sal_Int32 i, sal_Int16 radix) SAL_THROW_EXTERN_C()
Create the string representation of an integer.
friend libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type operator==(T &value, const OString &rStr2)
Definition: string.hxx:1268
SAL_DLLPUBLIC sal_Int32 rtl_str_lastIndexOfStr_WithLength(const char *str, sal_Int32 len, const char *subStr, sal_Int32 subLen) SAL_THROW_EXTERN_C()
Search for the last occurrence of a substring within a string.
friend libreoffice_internal::CharPtrDetector< T, bool >::Type operator==(const OString &rStr1, const T &value)
Definition: string.hxx:1241
SAL_WARN_UNUSED_RESULT OString concat(const OString &str) const
Concatenates the specified string to the end of this string.
Definition: string.hxx:1653
sal_Int32 compareTo(const OString &str) const
Compares two strings.
Definition: string.hxx:692
bool operator!=(const Any &rAny, const C &value)
Template inequality operator: compares set value of left side any to right side value.
Definition: Any.hxx:673
SAL_DLLPUBLIC sal_Int64 rtl_str_toInt64(const char *str, sal_Int16 radix) SAL_THROW_EXTERN_C()
Interpret a string as a long integer.
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type endsWith(T &literal, OString *rest=NULL) const
This is an overloaded member function, provided for convenience. It differs from the above function ...
Definition: string.hxx:1186
sal_Int32 reverseCompareTo(const OString &str) const
Compares two strings in reverse order.
Definition: string.hxx:729
bool operator<(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:93
bool operator>(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:103
OString(rtl_String *str, __sal_NoAcquire)
New string from OString data without acquiring it.
Definition: string.hxx:275
SAL_DLLPUBLIC void rtl_string_newToAsciiUpperCase(rtl_String **newStr, rtl_String *str) SAL_THROW_EXTERN_C()
Create a new string by converting all ASCII lowercase letters to uppercase within another string...
sal_uInt64 toUInt64(sal_Int16 radix=10) const
Returns the uint64 value from this string.
Definition: string.hxx:1954
SAL_DLLPUBLIC double rtl_str_toDouble(const char *str) SAL_THROW_EXTERN_C()
Interpret a string as a double.
SAL_DLLPUBLIC void rtl_string_new(rtl_String **newStr) SAL_THROW_EXTERN_C()
Allocate a new string containing no characters.
bool operator==(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:113
size_t operator()(const OString &rString) const
Compute a hash code for a string.
Definition: string.hxx:2298
Definition: stringutils.hxx:140
OString(char value)
New string from a single character.
Definition: string.hxx:285
#define SAL_DEPRECATED(message)
Use as follows: SAL_DEPRECATED("Don&#39;t use, it&#39;s evil.") void doit(int nPara);.
Definition: types.h:474
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:587
SAL_DLLPUBLIC sal_Int32 rtl_str_hashCode(const char *str) SAL_THROW_EXTERN_C()
Return a hash code for a string.
A helper to use OStrings with hash maps.
Definition: string.hxx:2287
SAL_DLLPUBLIC void rtl_string_newFromSubString(rtl_String **newStr, const rtl_String *from, sal_Int32 beginIndex, sal_Int32 count) SAL_THROW_EXTERN_C()
Allocate a new string that is a substring of this string.
static OString number(long long ll, sal_Int16 radix=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:2055
libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type equalsIgnoreAsciiCase(T &asciiStr) const
Definition: string.hxx:843
bool startsWithIgnoreAsciiCase(OString const &str, OString *rest=NULL) const
Check whether this string starts with a given string, ignoring the case of ASCII letters.
Definition: string.hxx:1115
bool equalsIgnoreAsciiCase(const OString &str) const
Perform an ASCII lowercase comparison of two strings.
Definition: string.hxx:804
static OString number(float f)
Returns the string representation of the float argument.
Definition: string.hxx:2077
bool matchIgnoreAsciiCase(const OString &str, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string, ignoring the case of ASCII letters.
Definition: string.hxx:1007
static OString number(double d)
Returns the string representation of the double argument.
Definition: string.hxx:2092
sal_Int32 lastIndexOf(const OString &str) const
Returns the index within this string of the last occurrence of the specified substring, searching backward starting at the end.
Definition: string.hxx:1532
SAL_DLLPUBLIC void rtl_uString2String(rtl_String **newStr, const sal_Unicode *str, sal_Int32 len, rtl_TextEncoding encoding, sal_uInt32 convertFlags) SAL_THROW_EXTERN_C()
Create a new byte string by converting a Unicode string, using a specific text encoding.
char toChar() const
Returns the first character from this string.
Definition: string.hxx:1890
SAL_DLLPUBLIC void rtl_string_newTrim(rtl_String **newStr, rtl_String *str) SAL_THROW_EXTERN_C()
Create a new string by removing white space from both ends of another string.
SAL_DLLPUBLIC void rtl_string_release(rtl_String *str) SAL_THROW_EXTERN_C()
Decrement the reference count of a string.
#define RTL_STR_MAX_VALUEOFDOUBLE
Definition: string.h:715
sal_Int32 toInt32(sal_Int16 radix=10) const
Returns the int32 value from this string.
Definition: string.hxx:1905
sal_uInt16 sal_Unicode
Definition: types.h:123
SAL_DLLPUBLIC sal_Int32 rtl_str_lastIndexOfChar_WithLength(const char *str, sal_Int32 len, char ch) SAL_THROW_EXTERN_C()
Search for the last occurrence of a character within a string.
SAL_WARN_UNUSED_RESULT OString replaceFirst(OString const &from, OString const &to, sal_Int32 *index=NULL) const
Returns a new string resulting from replacing the first occurrence of a given substring with another ...
Definition: string.hxx:1738
SAL_WARN_UNUSED_RESULT OString trim() const
Returns a new string resulting from removing white space from both ends of the string.
Definition: string.hxx:1815
SAL_WARN_UNUSED_RESULT OString replaceAll(OString const &from, OString const &to) const
Returns a new string resulting from replacing all occurrences of a given substring with another subst...
Definition: string.hxx:1762
unsigned char sal_Bool
Definition: types.h:38
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfDouble(char *str, double d) SAL_THROW_EXTERN_C()
Create the string representation of a double.
#define RTL_STR_MAX_VALUEOFBOOLEAN
Definition: string.h:589
__sal_NoAcquire
Definition: types.h:352
SAL_DLLPUBLIC sal_Int32 rtl_str_shortenedCompareIgnoreAsciiCase_WithLength(const char *first, sal_Int32 firstLen, const char *second, sal_Int32 secondLen, sal_Int32 shortenedLen) SAL_THROW_EXTERN_C()
Compare two strings with a maximum count of characters, ignoring the case of ASCII characters...
SAL_DLLPUBLIC sal_Int32 rtl_str_compareIgnoreAsciiCase_WithLength(const char *first, sal_Int32 firstLen, const char *second, sal_Int32 secondLen) SAL_THROW_EXTERN_C()
Compare two strings, ignoring the case of ASCII characters.
OString()
New string containing no characters.
Definition: string.hxx:225
SAL_DLLPUBLIC sal_Bool rtl_str_toBoolean(const char *str) SAL_THROW_EXTERN_C()
Interpret a string as a boolean.
SAL_WARN_UNUSED_RESULT OString copy(sal_Int32 beginIndex) const
Returns a new string that is a substring of this string.
Definition: string.hxx:1580
SAL_DLLPUBLIC sal_uInt64 rtl_str_toUInt64(const char *str, sal_Int16 radix) SAL_THROW_EXTERN_C()
Interpret a string as an unsigned long integer.
friend libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type operator==(const OString &rStr1, T &value)
Definition: string.hxx:1250
bool operator()(const char *p1, const char *p2) const
Definition: string.hxx:2305
sal_uInt16 rtl_TextEncoding
The various supported text encodings.
Definition: textenc.h:37
friend libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator!=(T &literal, const OString &rStr)
This is an overloaded member function, provided for convenience. It differs from the above function ...
Definition: string.hxx:1361
sal_Int32 indexOf(char ch, sal_Int32 fromIndex=0) const
Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index.
Definition: string.hxx:1391
Definition: bootstrap.hxx:33
bool endsWith(OString const &str, OString *rest=NULL) const
Check whether this string ends with a given substring.
Definition: string.hxx:1170
SAL_DLLPUBLIC sal_Int32 rtl_string_getToken(rtl_String **newStr, rtl_String *str, sal_Int32 token, char cTok, sal_Int32 idx) SAL_THROW_EXTERN_C()
Create a new string by extracting a single token from another string.
SAL_DLLPUBLIC sal_Int32 rtl_str_indexOfChar_WithLength(const char *str, sal_Int32 len, char ch) SAL_THROW_EXTERN_C()
Search for the first occurrence of a character within a string.
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type startsWithIgnoreAsciiCase(T &literal, OString *rest=NULL) const
This is an overloaded member function, provided for convenience. It differs from the above function ...
Definition: string.hxx:1133
SAL_DLLPUBLIC void rtl_string_ensureCapacity(rtl_String **str, sal_Int32 size) SAL_THROW_EXTERN_C()
Ensure a string has enough space for a given number of characters.
static OString boolean(bool b)
Returns the string representation of the boolean argument.
Definition: string.hxx:2126
Hashing functor for classic c-strings (i.e., null-terminated char* strings).
Definition: string.hxx:2310
SAL_DLLPUBLIC void rtl_string_newConcat(rtl_String **newStr, rtl_String *left, rtl_String *right) SAL_THROW_EXTERN_C()
Create a new string that is the concatenation of two other strings.
sal_uInt32 toUInt32(sal_Int16 radix=10) const
Returns the uint32 value from this string.
Definition: string.hxx:1922
libreoffice_internal::CharPtrDetector< T, bool >::Type equalsIgnoreAsciiCase(const T &asciiStr) const
Perform an ASCII lowercase comparison of two strings.
Definition: string.hxx:837
This String class provide base functionality for C++ like 8-Bit character array handling.
Definition: string.hxx:215
friend libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type operator!=(T &value, const OString &rStr2)
Definition: string.hxx:1339
void clear()
Clears the string, i.e, makes a zero-character string.
Definition: string.hxx:624
SAL_DLLPUBLIC void rtl_string_newReplaceAll(rtl_String **newStr, rtl_String *str, char const *from, sal_Int32 fromLength, char const *to, sal_Int32 toLength) SAL_THROW_EXTERN_C()
Create a new string by replacing all occurrences of a given substring with another substring...
SAL_WARN_UNUSED_RESULT OString replace(char oldChar, char newChar) const
Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar...
Definition: string.hxx:1713
definition of a no acquire enum for ctors
Definition: types.h:356
OString(const char *value, sal_Int32 length)
New string from a character buffer array.
Definition: string.hxx:366
float toFloat() const
Returns the float value from this string.
Definition: string.hxx:1967
SAL_DLLPUBLIC void rtl_string_assign(rtl_String **str, rtl_String *rightValue) SAL_THROW_EXTERN_C()
Assign a new value to a string.
bool equalsIgnoreAsciiCaseL(const char *asciiStr, sal_Int32 asciiStrLength) const
Perform an ASCII lowercase comparison of two strings.
Definition: string.hxx:889
sal_Int32 oslInterlockedCount
Definition: interlck.h:44
OString(const T &value, typename libreoffice_internal::CharPtrDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy())
New string from a character buffer array.
Definition: string.hxx:306
SAL_DLLPUBLIC void rtl_string_newFromLiteral(rtl_String **newStr, const char *value, sal_Int32 len, sal_Int32 allocExtra) SAL_THROW_EXTERN_C()
Definition: stringutils.hxx:142
static OString number(unsigned long long ll, sal_Int16 radix=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:2062
bool endsWithL(char const *str, sal_Int32 strLength) const
Check whether this string ends with a given substring.
Definition: string.hxx:1222
OString(T &literal, typename libreoffice_internal::ConstCharArrayDetector< T, libreoffice_internal::Dummy >::Type=libreoffice_internal::Dummy())
New string from a string literal.
Definition: string.hxx:339
static OString number(int i, sal_Int16 radix=10)
Returns the string representation of the integer argument.
Definition: string.hxx:2030
SAL_DLLPUBLIC void rtl_string_newReplaceStrAt(rtl_String **newStr, rtl_String *str, sal_Int32 idx, sal_Int32 count, rtl_String *subStr) SAL_THROW_EXTERN_C()
Create a new string by replacing a substring of another string.
Equality functor for classic c-strings (i.e., null-terminated char* strings).
Definition: string.hxx:2303
SAL_DLLPUBLIC sal_Int32 rtl_str_getLength(const char *str) SAL_THROW_EXTERN_C()
Return the length of a string.
sal_Int32 compareTo(const OString &rObj, sal_Int32 maxLength) const
Compares two strings with an maximum count of characters.
Definition: string.hxx:711
#define SAL_WARN_UNUSED_RESULT
Use this as markup for functions and methods whose return value must be checked.
Definition: types.h:284
bool isEmpty() const
Checks if a string is empty.
Definition: string.hxx:647
friend libreoffice_internal::ConstCharArrayDetector< T, bool >::Type operator==(T &literal, const OString &rStr)
This is an overloaded member function, provided for convenience. It differs from the above function ...
Definition: string.hxx:1304
SAL_DLLPUBLIC void rtl_string_newReplaceFirst(rtl_String **newStr, rtl_String *str, char const *from, sal_Int32 fromLength, char const *to, sal_Int32 toLength, sal_Int32 *index) SAL_THROW_EXTERN_C()
Create a new string by replacing the first occurrence of a given substring with another substring...
SAL_DLLPUBLIC sal_Int32 rtl_str_valueOfInt64(char *str, sal_Int64 l, sal_Int16 radix) SAL_THROW_EXTERN_C()
Create the string representation of a long integer.
friend libreoffice_internal::CharPtrDetector< T, bool >::Type operator!=(const OString &rStr1, const T &value)
Definition: string.hxx:1321
SAL_DLLPUBLIC sal_Int32 rtl_str_hashCode_WithLength(const char *str, sal_Int32 len) SAL_THROW_EXTERN_C()
Return a hash code for a string.
sal_Int32 lastIndexOf(char ch, sal_Int32 fromIndex) const
Returns the index within this string of the last occurrence of the specified character, searching backward starting before the specified index.
Definition: string.hxx:1423
SAL_DLLPUBLIC void rtl_string_newFromStr(rtl_String **newStr, const char *value) SAL_THROW_EXTERN_C()
Allocate a new string that contains a copy of a character array.
SAL_WARN_UNUSED_RESULT OString replaceAt(sal_Int32 index, sal_Int32 count, const OString &newStr) const
Returns a new string resulting from replacing n = count characters from position index in this string...
Definition: string.hxx:1683
SAL_DLLPUBLIC sal_Int32 rtl_str_compare_WithLength(const char *first, sal_Int32 firstLen, const char *second, sal_Int32 secondLen) SAL_THROW_EXTERN_C()
Compare two strings.
bool match(const OString &str, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string.
Definition: string.hxx:920
OString(rtl_String *str)
New string from OString data.
Definition: string.hxx:262
SAL_DLLPUBLIC void rtl_string_acquire(rtl_String *str) SAL_THROW_EXTERN_C()
Increment the reference count of a string.
bool startsWith(OString const &str, OString *rest=NULL) const
Check whether this string starts with a given substring.
Definition: string.hxx:1058
libreoffice_internal::ConstCharArrayDetector< T, sal_Int32 >::Type indexOf(T &literal, sal_Int32 fromIndex=0) const
This is an overloaded member function, provided for convenience. It differs from the above function ...
Definition: string.hxx:1464
static OString number(unsigned int i, sal_Int16 radix=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:2037
SAL_DLLPUBLIC sal_Int32 rtl_str_compare(const char *first, const char *second) SAL_THROW_EXTERN_C()
Compare two strings.
static OString number(long i, sal_Int16 radix=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: string.hxx:2043
bool toBoolean() const
Returns the Boolean value from this string.
Definition: string.hxx:1879
OString & operator=(const OString &str)
Assign a new string.
Definition: string.hxx:481
friend libreoffice_internal::NonConstCharArrayDetector< T, bool >::Type operator!=(const OString &rStr1, T &value)
Definition: string.hxx:1327
OString & operator+=(const OString &str)
Append a string to this string.
Definition: string.hxx:532
SAL_WARN_UNUSED_RESULT OString toAsciiLowerCase() const
Converts from this string all ASCII uppercase characters (65-90) to ASCII lowercase characters (97-12...
Definition: string.hxx:1780
SAL_DLLPUBLIC void rtl_string_newReplace(rtl_String **newStr, rtl_String *str, char oldChar, char newChar) SAL_THROW_EXTERN_C()
Create a new string by replacing all occurrences of a single character within another string...
SAL_DLLPUBLIC float rtl_str_toFloat(const char *str) SAL_THROW_EXTERN_C()
Interpret a string as a float.
friend OString operator+(const OString &str1, const OString &str2)
Definition: string.hxx:1662
sal_Int32 lastIndexOf(char ch) const
Returns the index within this string of the last occurrence of the specified character, searching backward starting at the end.
Definition: string.hxx:1406
libreoffice_internal::ConstCharArrayDetector< T, bool >::Type match(T &literal, sal_Int32 fromIndex=0) const
This is an overloaded member function, provided for convenience. It differs from the above function ...
Definition: string.hxx:933
bool matchL(char const *str, sal_Int32 strLength, sal_Int32 fromIndex=0) const
Match against a substring appearing in this string.
Definition: string.hxx:964
friend libreoffice_internal::CharPtrDetector< T, bool >::Type operator!=(const T &value, const OString &rStr2)
Definition: string.hxx:1333
sal_Int32 hashCode() const
Returns a hashcode for this string.
Definition: string.hxx:1373
SAL_DLLPUBLIC sal_Int32 rtl_str_toInt32(const char *str, sal_Int16 radix) SAL_THROW_EXTERN_C()
Interpret a string as an integer.
SAL_DLLPUBLIC rtl_String * rtl_string_alloc(sal_Int32 nLen) SAL_THROW_EXTERN_C()
Allocate a new string containing space for a given number of characters.
friend libreoffice_internal::CharPtrDetector< T, bool >::Type operator==(const T &value, const OString &rStr2)
Definition: string.hxx:1259
SAL_DLLPUBLIC void rtl_string_newFromStr_WithLength(rtl_String **newStr, const char *value, sal_Int32 len) SAL_THROW_EXTERN_C()
Allocate a new string that contains a copy of a character array.
SAL_DLLPUBLIC void rtl_string_newToAsciiLowerCase(rtl_String **newStr, rtl_String *str) SAL_THROW_EXTERN_C()
Create a new string by converting all ASCII uppercase letters to lowercase within another string...
sal_Int32 indexOfL(char const *str, sal_Int32 len, sal_Int32 fromIndex=0) const
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
Definition: string.hxx:1494