CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
string.h
1
2#ifndef _aspose_system_string_h_
3#define _aspose_system_string_h_
4
5#include <system/text/normalization_form.h>
6#include <system/string_comparison.h>
7#include <system/shared_ptr.h>
8#include <system/details/icu_namespace.h>
9#include <system/details/stack_array.h>
10#include <system/object.h>
11
12#include <istream>
13#include <ostream>
14#include <string>
15#include <sstream>
16#include <system/diagnostics/debug.h>
17#include <iterator>
18#include <cstdint>
19
20#include <fwd.h>
21
22#ifdef ASPOSECPPLIB_BEING_BUILT
23#include <unicode/unistr.h>
24#endif
26ASPOSECPP_3RD_PARTY_ICU_NAMESPACE_START {
28 ASPOSECPP_3RD_PARTY_CLASS(UnicodeString);
29}
30
32ASPOSECPP_3RD_PARTY_TYPEDEF(UChar, char16_t);
33
34namespace System { namespace Text { class StringBuilder; } }
35namespace System { namespace Text { namespace RegularExpressions { class Regex; } } }
36namespace System { namespace Text { namespace RegularExpressions { namespace Detail { class Formatter; } } } }
37namespace System { namespace Globalization { class CompareInfo; } }
38namespace System { namespace Globalization { class TextElementEnumerator; } }
39namespace System { namespace Globalization { class TextInfo; } }
40namespace System { namespace Collections { namespace Generic { template <typename T> class IEnumerable; } } }
41
42namespace System { namespace Details { template<typename T> class ArrayView; } }
43
44namespace System
45{
46
47namespace Detail {
49 ASPOSECPP_3RD_PARTY_TYPE_HOLDER(codeporting_icu::UnicodeString, UnicodeString, 64, size_t, UnicodeStringHolder);
50}
51
54{
56 None = 0,
59};
60
61using codeporting_icu::UnicodeString;
62
66template <typename T, typename CharT>
68 : public std::integral_constant<bool, std::is_same<typename std::remove_const<typename std::remove_pointer<typename std::decay<T>::type>::type>::type, CharT>::value> {};
69
73template <typename T, typename CharT>
75 public std::integral_constant<bool, IsStringByteSequence<T, CharT>::value && std::is_pointer<T>::value> {};
76
80template <typename T, typename CharT>
82 public std::integral_constant<bool, IsStringByteSequence<T, CharT>::value && std::is_array<T>::value> {};
83
121class ASPOSECPP_SHARED_CLASS String
122{
123 static const uintptr_t state_literal = 0;
124 static const uintptr_t state_null = 1;
125
129 friend class System::Text::RegularExpressions::Regex; // Uses private method Append for efficient string construction.
130 friend class System::Text::RegularExpressions::Detail::Formatter; // Uses private method Append for efficient string construction.
132 friend class System::Object;
133
134 using ThisType = String;
135
137 RTTI_INFO_VALUE_TYPE(System::String);
138public:
140 using reverse_iterator = std::reverse_iterator<const char16_t*>;
141
144
146 ASPOSECPP_SHARED_API String();
147
150 template<typename T>
151 String(T& value, typename std::enable_if<IsStringLiteral<T, char16_t>::value>::type* = nullptr)
152 : String(value, std::extent<T>::value - 1, state_literal)
153 {}
154
157 template<typename T>
158 String(const T& value, typename std::enable_if<IsStringPointer<T, char16_t>::value>::type* = nullptr)
159 : String(value, -1)
160 {
161 m_state = state_literal;
162 }
163
166 template<typename T>
167 explicit String(T& value, typename std::enable_if<IsStringLiteral<T, char>::value>::type* = nullptr)
168 : String(value, std::extent<T>::value - 1)
169 {
170 m_state = state_literal;
171 }
172
175 template<typename T>
176 explicit String(const T& value, typename std::enable_if<IsStringPointer<T, char>::value>::type* = nullptr)
177 : String(value, -1)
178 {
179 m_state = state_literal;
180 }
181
185 ASPOSECPP_SHARED_API String(const char16_t* str, int length);
186
190 ASPOSECPP_SHARED_API String(const char* str, int length);
191
196 ASPOSECPP_SHARED_API String(const char16_t* str, int start, int length);
197
201 ASPOSECPP_SHARED_API explicit String(const char16_t ch, int count);
202
206 template<typename T>
207 String(const T& value,
208 typename std::enable_if<std::is_same<T, std::nullptr_t>::value>::type* = nullptr)
209 : String()
210 {
211 ASPOSE_UNUSED(value);
212 }
213
217 template<typename T>
218 explicit String(T& value, typename std::enable_if<IsStringLiteral<T, wchar_t>::value>::type* = nullptr)
219 : String(value, std::extent<T>::value - 1)
220 {}
221
225 template<typename T>
226 explicit String(const T& value, typename std::enable_if<IsStringPointer<T, wchar_t>::value>::type* = nullptr)
227 : String(value, -1)
228 {}
229
234 ASPOSECPP_SHARED_API explicit String(const wchar_t* str, int length);
239 ASPOSECPP_SHARED_API explicit String(const wchar_t ch, int count = 1);
240
243 ASPOSECPP_SHARED_API String(const String& str);
246 ASPOSECPP_SHARED_API String(String&& str) noexcept;
247
250 ASPOSECPP_SHARED_API String(const ArrayPtr<char16_t>& arr);
255 ASPOSECPP_SHARED_API String(const ArrayPtr<char16_t>& arr, int offset, int len);
256
258 ASPOSECPP_SHARED_API ~String();
259
262 ASPOSECPP_SHARED_API const UChar* u_str() const;
263
266 ASPOSECPP_SHARED_API const UChar* begin() const;
269 ASPOSECPP_SHARED_API const UChar* end() const;
270
273 ASPOSECPP_SHARED_API reverse_iterator rbegin() const;
276 ASPOSECPP_SHARED_API reverse_iterator rend() const;
277
280 ASPOSECPP_SHARED_API bool IsNullOrEmpty() const;
281
285 inline bool IsNull() const { return m_state == state_null; }
286
289 ASPOSECPP_SHARED_API bool IsEmpty() const;
290
293 ASPOSECPP_SHARED_API std::string ToUtf8String() const;
296 ASPOSECPP_SHARED_API std::wstring ToWCS() const;
299 ASPOSECPP_SHARED_API std::u16string ToU16Str() const;
302 ASPOSECPP_SHARED_API std::u32string ToU32Str() const;
306 ASPOSECPP_SHARED_API std::string ToAsciiString() const;
307
310 ASPOSECPP_SHARED_API String& reset();
311
314 ASPOSECPP_SHARED_API int get_Length() const;
318 ASPOSECPP_SHARED_API char_t operator[](int index) const;
323 ASPOSECPP_SHARED_API String& SetCharAt(int index, char_t ch);
324
328 ASPOSECPP_SHARED_API String& operator=(const String& str);
332 ASPOSECPP_SHARED_API String& operator=(String&& str) noexcept;
333
337 ASPOSECPP_SHARED_API String operator+(const String& str) const;
342 template <typename T, std::enable_if_t<IsStringLiteral<T, char_t>::value>* = nullptr>
343 String operator+(const T& arg) const
344 {
345 return *this + String(arg, std::extent<T>::value - 1);
346 }
347
351 ASPOSECPP_SHARED_API String operator+(char_t x) const;
355 ASPOSECPP_SHARED_API String operator+(int i) const;
359 ASPOSECPP_SHARED_API String operator+(uint32_t i) const;
363 ASPOSECPP_SHARED_API String operator+(double d) const;
367 ASPOSECPP_SHARED_API String operator+(int64_t v) const;
372 template <typename T, std::enable_if_t<IsSmartPtr<T>::value>* = nullptr>
373 String operator+(const T& value) const
374 {
375 return value == nullptr ? *this : *this + value->ToString();
376 }
381 template <typename T, std::enable_if_t<!IsSmartPtr<T>::value && !std::is_scalar<T>::value && !std::is_array<T>::value>* = nullptr>
382 String operator+(const T& value) const
383 {
384 return *this + value.ToString();
385 }
390 template <typename T, std::enable_if_t<std::is_same<T, bool>::value>* = nullptr>
391 String operator+(T arg) const
392 {
393 return String(*this).AddBoolImpl(arg);
394 }
395
399 ASPOSECPP_SHARED_API String& operator+=(char_t c);
403 ASPOSECPP_SHARED_API String& operator+=(const String& str);
407 ASPOSECPP_SHARED_API String& operator+=(double value);
411 ASPOSECPP_SHARED_API String& operator+=(uint8_t value);
415 ASPOSECPP_SHARED_API String& operator+=(int16_t value);
419 ASPOSECPP_SHARED_API String& operator+=(uint16_t value);
423 ASPOSECPP_SHARED_API String& operator+=(int32_t value);
427 ASPOSECPP_SHARED_API String& operator+=(uint32_t value);
431 ASPOSECPP_SHARED_API String& operator+=(int64_t value);
435 ASPOSECPP_SHARED_API String& operator+=(uint64_t value);
440 template <typename T, std::enable_if_t<std::is_same<T, bool>::value>* = nullptr>
442 {
443 return AddBoolImpl(value);
444 }
445
449 ASPOSECPP_SHARED_API bool operator==(const String& str) const;
452 ASPOSECPP_SHARED_API bool operator==(std::nullptr_t) const;
453
454
458 ASPOSECPP_SHARED_API bool operator!=(const String& str) const;
461 ASPOSECPP_SHARED_API bool operator!=(std::nullptr_t) const;
462
466 ASPOSECPP_SHARED_API bool operator<(const String& str) const;
467
471 ASPOSECPP_SHARED_API bool operator>(const String& str) const;
472
475 explicit operator std::string() const
476 {
477 return ToUtf8String();
478 }
481 explicit operator std::wstring() const
482 {
483 return ToWCS();
484 }
487 explicit operator std::u16string() const
488 {
489 return ToU16Str();
490 }
493 explicit operator std::u32string() const
494 {
495 return ToU32Str();
496 }
497
500 ASPOSECPP_SHARED_API String Clone() const;
501
504 String ToString() const { return *this; }
507 String ToString(const SharedPtr<IFormatProvider>&) const { return *this; }
508
511 ASPOSECPP_SHARED_API int GetHashCode() const;
516 ASPOSECPP_SHARED_API bool Equals(const String& str, System::StringComparison comparison_type) const;
520 ASPOSECPP_SHARED_API bool Equals(const String& str) const;
521
525 ASPOSECPP_SHARED_API bool Contains(const String& str) const;
529 ASPOSECPP_SHARED_API bool Contains(char16_t value) const;
533 ASPOSECPP_SHARED_API int CompareTo(const String& str) const;
539 ASPOSECPP_SHARED_API void CopyTo(int sourceIndex, const ArrayPtr<char_t>& destination, int destinationIndex, int count) const;
543 ASPOSECPP_SHARED_API String Normalize(System::Text::NormalizationForm form) const;
547 ASPOSECPP_SHARED_API bool IsNormalized(System::Text::NormalizationForm form) const;
548
552 ASPOSECPP_SHARED_API bool StartsWith(const String& value) const;
557 ASPOSECPP_SHARED_API bool StartsWith(const String& value, System::StringComparison comparisonType) const;
563 ASPOSECPP_SHARED_API bool StartsWith(const String& value, bool ignoreCase, const SharedPtr<System::Globalization::CultureInfo>& culture = nullptr) const;
564
568 ASPOSECPP_SHARED_API bool EndsWith(const String& value) const;
573 ASPOSECPP_SHARED_API bool EndsWith(const String& value, System::StringComparison comparisonType) const;
579 ASPOSECPP_SHARED_API bool EndsWith(const String& value, bool ignoreCase, const SharedPtr<System::Globalization::CultureInfo>& culture = nullptr) const;
580
585 ASPOSECPP_SHARED_API ArrayPtr<char_t> ToCharArray(int32_t startIndex = 0, int32_t length = INT32_MAX) const;
591 ASPOSECPP_SHARED_API ArrayPtr<uint8_t> ToByteArray(int32_t startIndex = 0, int32_t length = INT32_MAX, bool LE = true) const;
592
595 ASPOSECPP_SHARED_API String ToUpper() const;
598 ASPOSECPP_SHARED_API String ToLower() const;
599
603 ASPOSECPP_SHARED_API String ToLower(const SharedPtr<System::Globalization::CultureInfo>& cultureInfo) const;
607 ASPOSECPP_SHARED_API String ToUpper(const SharedPtr<System::Globalization::CultureInfo>& cultureInfo) const;
608
611 ASPOSECPP_SHARED_API String ToUpperInvariant() const;
614 ASPOSECPP_SHARED_API String ToLowerInvariant() const;
615
619 ASPOSECPP_SHARED_API String Substring(int32_t startIndex) const;
624 ASPOSECPP_SHARED_API String Substring(int32_t startIndex, int32_t length) const;
629 ASPOSECPP_SHARED_API String Remove(int32_t startIndex, int32_t count = INT32_MAX) const;
630
634 bool Is(const System::TypeInfo &target) const
635 {
636 return GetType() == target;
637 }
638
639 // Finds
640
645 ASPOSECPP_SHARED_API int IndexOf(const String& str, System::StringComparison comparison_type) const;
650 ASPOSECPP_SHARED_API int IndexOf(char_t c, int startIndex = 0) const;
656 ASPOSECPP_SHARED_API int IndexOf(char_t c, int startIndex, int count) const;
661 ASPOSECPP_SHARED_API int IndexOf(const String& str, int startIndex = 0) const;
667 ASPOSECPP_SHARED_API int IndexOf(const String& str, int startIndex, System::StringComparison comparison_type) const;
674 ASPOSECPP_SHARED_API int IndexOf(const String& value, int startIndex, int count, System::StringComparison comparisonType) const;
680 ASPOSECPP_SHARED_API int IndexOf(const String& str, int startIndex, int count) const;
681
686 ASPOSECPP_SHARED_API int IndexOfAny(char_t c, int startIndex = 0) const;
691 ASPOSECPP_SHARED_API int IndexOfAny(const String& str, int startIndex = 0) const;
696 ASPOSECPP_SHARED_API int IndexOfAny(const ArrayPtr<char_t>& anyOf) const;
702 ASPOSECPP_SHARED_API int IndexOfAny(const ArrayPtr<char_t>& anyOf, int32_t startindex) const;
709 ASPOSECPP_SHARED_API int IndexOfAny(const ArrayPtr<char_t>& anyOf, int32_t startindex, int32_t count) const;
710
715 ASPOSECPP_SHARED_API int LastIndexOf(const String& str, int startIndex = INT32_MAX) const;
720 ASPOSECPP_SHARED_API int LastIndexOf(const String& str, System::StringComparison comparison_type) const;
726 ASPOSECPP_SHARED_API int LastIndexOf(const String& str, int startIndex, System::StringComparison comparison_type) const;
733 ASPOSECPP_SHARED_API int LastIndexOf(const String& value, int startIndex, int count, StringComparison comparisonType) const;
734
738 ASPOSECPP_SHARED_API int LastIndexOf(char_t value) const;
743 ASPOSECPP_SHARED_API int LastIndexOf(char_t value, int32_t startIndex) const;
749 ASPOSECPP_SHARED_API int LastIndexOf(char_t value, int32_t startIndex, int32_t count) const;
750
755 ASPOSECPP_SHARED_API int LastIndexOfAny(const ArrayPtr<char_t>& anyOf) const;
761 ASPOSECPP_SHARED_API int LastIndexOfAny(const ArrayPtr<char_t>& anyOf, int32_t startindex) const;
768 ASPOSECPP_SHARED_API int LastIndexOfAny(const ArrayPtr<char_t>& anyOf, int32_t startindex, int32_t count) const;
769
770 // Trim
771
774 ASPOSECPP_SHARED_API String Trim() const;
778 ASPOSECPP_SHARED_API String Trim(char_t ch) const;
782 ASPOSECPP_SHARED_API String Trim(const String& anyOf) const;
786 ASPOSECPP_SHARED_API String Trim(const ArrayPtr<char_t>& anyOf) const;
787
790 ASPOSECPP_SHARED_API String TrimStart() const;
794 ASPOSECPP_SHARED_API String TrimStart(char_t ch) const;
798 ASPOSECPP_SHARED_API String TrimStart(const String& anyOf) const;
802 ASPOSECPP_SHARED_API String TrimStart(const ArrayPtr<char_t>& anyOf) const;
803
806 ASPOSECPP_SHARED_API String TrimEnd() const;
810 ASPOSECPP_SHARED_API String TrimEnd(char_t ch) const;
814 ASPOSECPP_SHARED_API String TrimEnd(const String& anyOf) const;
818 ASPOSECPP_SHARED_API String TrimEnd(const ArrayPtr<char_t>& anyOf) const;
819
824 ASPOSECPP_SHARED_API String PadLeft(int totalWidth, char_t c = u' ') const;
829 ASPOSECPP_SHARED_API String PadRight(int totalWidth, char_t c = u' ') const;
830
831 // Replace
832
837 ASPOSECPP_SHARED_API String Replace(char_t oldValue, char_t newValue) const;
842 ASPOSECPP_SHARED_API String Replace(const String& oldValue, const String& newValue) const;
843
844 // Insert
845
850 ASPOSECPP_SHARED_API String Insert(int startIndex, const String& value) const;
851
852 // Split
857 ASPOSECPP_SHARED_API ArrayPtr<String> Split(char_t separator = u' ', StringSplitOptions opt = StringSplitOptions::None) const;
863 ASPOSECPP_SHARED_API ArrayPtr<String> Split(char_t separator, int32_t count, StringSplitOptions opt = StringSplitOptions::None) const;
869 ASPOSECPP_SHARED_API ArrayPtr<String> Split(char_t separatorA, char_t separatorB, StringSplitOptions opt = StringSplitOptions::None) const;
874 ASPOSECPP_SHARED_API ArrayPtr<String> Split(const ArrayPtr<char_t>& separators, StringSplitOptions opt = StringSplitOptions::None) const;
880 ASPOSECPP_SHARED_API ArrayPtr<String> Split(const ArrayPtr<char_t>& separators, int32_t count, StringSplitOptions opt = StringSplitOptions::None) const;
881
886 ASPOSECPP_SHARED_API ArrayPtr<String> Split(const String& separator, StringSplitOptions opt = StringSplitOptions::None) const;
892 ASPOSECPP_SHARED_API ArrayPtr<String> Split(const String& separator, int count, StringSplitOptions opt = StringSplitOptions::None) const;
897 ASPOSECPP_SHARED_API ArrayPtr<String> Split(const ArrayPtr<String>& separators, StringSplitOptions opt = StringSplitOptions::None) const;
903 ASPOSECPP_SHARED_API ArrayPtr<String> Split(const ArrayPtr<String>& separators, int count, StringSplitOptions opt = StringSplitOptions::None) const;
904
905 // static members
906
908 static const ASPOSECPP_SHARED_API String Empty;
910 static const ASPOSECPP_SHARED_API String Null;
911
915 static ASPOSECPP_SHARED_API bool IsNullOrEmpty(const String& str);
919 static ASPOSECPP_SHARED_API bool IsNullOrWhiteSpace(const String& str);
924 static ASPOSECPP_SHARED_API bool Equals(const String& strA, const String& strB);
930 static ASPOSECPP_SHARED_API bool Equals(const String& strA, const String& strB, System::StringComparison comparison_type);
931
940 static ASPOSECPP_SHARED_API int Compare(const String& strA, int indexA, const String& strB, int indexB,
941 int length, bool ignoreCase = false);
942
952 static ASPOSECPP_SHARED_API int Compare(const String& strA, int indexA, const String& strB, int indexB,
953 int length, bool ignoreCase,
955
961 static ASPOSECPP_SHARED_API int Compare(const String& strA, const String& strB, System::StringComparison comparison_type);
970 static ASPOSECPP_SHARED_API int Compare(const String& strA, int indexA, const String& strB, int indexB,
971 int length, System::StringComparison comparison_type);
972
978 static ASPOSECPP_SHARED_API int Compare(const String& strA, const String& strB, bool ignoreCase = false);
985 static ASPOSECPP_SHARED_API int Compare(const String& strA, const String& strB, bool ignoreCase,
987
992 static ASPOSECPP_SHARED_API int CompareOrdinal(const String& strA, const String& strB);
1000 static ASPOSECPP_SHARED_API int CompareOrdinal(const String& strA, int indexA, const String& strB, int indexB, int length);
1001
1008 static ASPOSECPP_SHARED_API String Join(const String& separator, const ArrayPtr<String>& parts, int startIndex = 0, int count = -1);
1009
1016 static ASPOSECPP_SHARED_API String Join(const String& separator, const System::Details::ArrayView<String>& parts, int startIndex = 0, int count = -1);
1017
1022 static ASPOSECPP_SHARED_API String Join(const String& separator, const SharedPtr<System::Collections::Generic::IEnumerable<String> >& parts);
1023
1028 static ASPOSECPP_SHARED_API String Join(const String& separator, const ArrayPtr<SharedPtr<Object>>& parts);
1029
1033 static ASPOSECPP_SHARED_API String Concat(const ArrayPtr<String>& parts);
1038 static ASPOSECPP_SHARED_API String Concat(const String & str0, const String & str1);
1044 static ASPOSECPP_SHARED_API String Concat(const String & str0, const String & str1, const String & str2);
1045
1052 static ASPOSECPP_SHARED_API String Concat(const String& str0, const String& str1, const String& str2, const String& str3);
1053
1057 static String Copy(const String& str) { return str; }
1058
1064 template<class... Args>
1065 static String Format(const SharedPtr<IFormatProvider>& fp, const String& format, const Args&... args);
1066
1071 template<class... Args>
1072 static String Format(std::nullptr_t, const String& format, const Args&... args);
1073
1078 template<std::size_t N, class... Args>
1079 static String Format(std::nullptr_t, const char16_t(&format)[N], const Args&... args);
1080
1085 template<class... Args>
1086 static String Format(const String& format, const Args&... args);
1087
1092 template<class T>
1093 static String Format(const String& format, const System::ArrayPtr<T>& args);
1094
1098 static ASPOSECPP_SHARED_API String FromUtf8(const char* utf8);
1103 static ASPOSECPP_SHARED_API String FromUtf8(const char* utf8, int len);
1107 static ASPOSECPP_SHARED_API String FromUtf8(const uint8_t* utf8);
1111 static ASPOSECPP_SHARED_API String FromUtf8(const std::string& utf8);
1115 static ASPOSECPP_SHARED_API String FromWCS(const std::wstring& wcs);
1120 static ASPOSECPP_SHARED_API String FromUtf32(const uint32_t *utf32, int32_t length);
1124 static ASPOSECPP_SHARED_API String FromUtf16(const std::u16string& u16str);
1128 static ASPOSECPP_SHARED_API String FromAscii(const char* asciiStr);
1133 static ASPOSECPP_SHARED_API String FromAscii(const char* asciiStr, int len);
1137 static ASPOSECPP_SHARED_API String FromAscii(const std::string& asciiStr);
1138
1141 explicit ASPOSECPP_SHARED_API String(const codeporting_icu::UnicodeString& str);
1144 explicit ASPOSECPP_SHARED_API String(codeporting_icu::UnicodeString&& str) noexcept;
1147 explicit String(const std::wstring& str) : String(str.data(), ASPOSECPP_CHECKED_CAST(int, str.length())) {};
1150 explicit String(const std::u16string& str) : String(str.data(), ASPOSECPP_CHECKED_CAST(int, str.length())) {};
1153 explicit ASPOSECPP_SHARED_API String(const std::string& utf8str);
1156 explicit ASPOSECPP_SHARED_API String(const std::u32string& u32str);
1157
1160 bool ASPOSECPP_SHARED_API IsAsciiString() const;
1161
1166 int ASPOSECPP_SHARED_API FastToAscii(char buffer[], int buffer_size) const;
1167
1168protected:
1173 ASPOSECPP_SHARED_API String& Append(const char16_t *src,
1174 int32_t startIndex,
1175 int32_t count);
1176
1178 mutable Detail::UnicodeStringHolder m_str; // mutable because of u_str
1179
1183 uintptr_t m_state;
1184
1185#if defined(_DEBUG) && (defined(_MSC_VER) || defined(__GNUC__))
1186 union IcuDebugHelper
1187 {
1188 struct
1189 {
1190 int16_t fLengthAndFlags;
1191 char16_t fBuffer[(int32_t)(64 - sizeof(void *) - 2) / 2];
1192 } fStackFields;
1193 struct
1194 {
1195 int16_t fLengthAndFlags;
1196 int32_t fLength;
1197 int32_t fCapacity;
1198 char16_t *fArray;
1199 } fFields;
1200 } static icuDebugHelper;
1201#endif
1202
1203private:
1204 static bool StartsWithImpl(const String& that, const String& other, System::StringComparison comparisonType,
1206
1207 static bool EndsWithImpl(const String& that, const String& other, System::StringComparison comparisonType,
1209
1210 static int32_t CompareImpl(const String& strA, int32_t indexA, const String& strB, int32_t indexB,
1211 int32_t length, StringComparison comparisonType,
1213
1214 static int LastIndexOfOrdinalIgnoreCaseImpl(const String& source, const String& value, int startIndex, int count);
1215 static int IndexOfOrdinalIgnoreCaseImpl(const String& source, const String& value, int startIndex, int count);
1216
1217 ASPOSECPP_SHARED_API String& AddBoolImpl(bool value);
1218
1219 static SharedPtr<Text::StringBuilder> GetBuilder();
1220
1221 // Special ctor for literals
1222 ASPOSECPP_SHARED_API String(const char16_t* str, int length, uintptr_t state);
1223
1224 inline void SetState()
1225 {
1226 m_state = reinterpret_cast<uintptr_t>(this);
1227 }
1228
1229}; // class String
1230
1236template<typename T>
1237typename std::enable_if<IsStringLiteral<T, char_t>::value, String>::type inline operator+(T& left, const String& right)
1238{
1239 return String(left, std::extent<T>::value - 1) + right;
1240}
1241
1247template<typename T>
1248typename std::enable_if<IsStringPointer<T, char_t>::value, String>::type inline operator+(T& left, const String& right)
1249{
1250 return String(left) + right;
1251}
1252
1253
1258String inline operator+(const char_t left, const String& right)
1259{
1260 return String(left, 1) + right;
1261}
1262
1268template<class Chars, typename std::enable_if<IsStringLiteral<Chars, char_t>::value>::type* = nullptr>
1269bool inline operator==(Chars& left, const String& right)
1270{
1271 return String(left, std::extent<Chars>::value - 1) == right;
1272}
1273
1279template<class T, typename std::enable_if<IsStringPointer<T, char_t>::value>::type* = nullptr>
1280bool inline operator==(T& left, const String& right)
1281{
1282 return String(left) == right;
1283}
1284
1290template<class Chars, typename std::enable_if<IsStringLiteral<Chars, char_t>::value>::type* = nullptr>
1291bool inline operator!=(Chars& left, const String& right)
1292{
1293 return !(String(left, std::extent<Chars>::value - 1) == right);
1294}
1295
1301template<class T, typename std::enable_if<IsStringPointer<T, char_t>::value>::type* = nullptr>
1302bool inline operator!=(T& left, const String& right)
1303{
1304 return !(String(left) == right);
1305}
1306
1311ASPOSECPP_SHARED_API bool operator==(const SharedPtr<Object>& left, const String& right);
1316ASPOSECPP_SHARED_API bool operator!=(const SharedPtr<Object>& left, const String& right);
1317
1321ASPOSECPP_SHARED_API bool operator==(std::nullptr_t, const String& str);
1325ASPOSECPP_SHARED_API bool operator!=(std::nullptr_t, const String& str);
1326
1331ASPOSECPP_SHARED_API std::ostream& operator<<(std::ostream& os, const String& str);
1336ASPOSECPP_SHARED_API std::wostream& operator<<(std::wostream& os, const String& str);
1337
1342ASPOSECPP_SHARED_API std::istream& operator>>(std::istream &in, String &str);
1347ASPOSECPP_SHARED_API std::wistream& operator>>(std::wistream &in, String &str);
1348
1351template <>
1352struct CastResult<String>
1353{
1355 typedef String type;
1356};
1358
1362template <>
1363inline bool Object::ReferenceEquals(String const& str, std::nullptr_t)
1364{
1365 return str.IsNull();
1366}
1367
1372template <>
1373inline bool Object::ReferenceEquals(String const& str1, String const& str2)
1374{
1375 return str1.m_state == str2.m_state && (str1.m_state == String::state_null || str1 == str2);
1376}
1377
1381ASPOSECPP_SHARED_API void PrintTo(const System::String& value, std::ostream* os);
1382
1383
1384} // namespace System
1385
1386// boost::hash specialization for System::String
1387
1388namespace std
1389{
1391 template <>
1392 struct hash<System::String>
1393 {
1397 std::size_t operator()(const System::String& str) const
1398 {
1399 return static_cast<std::size_t>(str.GetHashCode());
1400 }
1401 };
1402}
1403
1405typedef char16_t* system_char_array;
1407typedef char16_t const* const_system_char_array;
1408
1409#include <system/details/format_builder.h>
1410
1411namespace System {
1412
1418template<class... Args>
1419String String::Format(const SharedPtr<IFormatProvider>& fp, const String& format, const Args&... args)
1420{
1421 System::Details::FormatBuilder builder(format, fp);
1422 System::Details::FormatBuilder::AddArguments(builder, args...);
1423
1424 return builder.BuildResult();
1425}
1426
1431template<class... Args>
1432String String::Format(std::nullptr_t, const String& format, const Args&... args)
1433{
1434 System::Details::FormatBuilder builder(format);
1435 System::Details::FormatBuilder::AddArguments(builder, args...);
1436
1437 return builder.BuildResult();
1438}
1439
1444template<std::size_t N, class... Args>
1445String String::Format(std::nullptr_t, const char16_t (&format)[N], const Args&... args)
1446{
1447 System::Details::FormatBuilder builder(format);
1448 System::Details::FormatBuilder::AddArguments(builder, args...);
1449
1450 return builder.BuildResult();
1451}
1452
1453
1458template<class... Args>
1459String String::Format(const String& format, const Args&... args)
1460{
1461 System::Details::FormatBuilder builder(format);
1462 System::Details::FormatBuilder::AddArguments(builder, args...);
1463
1464 return builder.BuildResult();
1465}
1466
1471template<class T>
1473{
1474 System::Details::FormatBuilder builder(format);
1475 System::Details::FormatBuilder::AddArguments(builder, args);
1476
1477 return builder.BuildResult();
1478}
1479} // namespace System
1480
1481#endif // _aspose_system_string_h_
Makes culture-sensitive string comparison. Objects of this class should only be allocated using Syste...
Definition: compare_info.h:24
Enumerator to iterate through string elements (characters). Objects of this class should only be allo...
Definition: text_element_enumerator.h:28
Defines locale-specific text properties. Setter operations are only enabled on non-read-only objects....
Definition: text_info.h:23
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:62
virtual const TypeInfo & GetType() const
Gets actual type of object. Analog of C# System.Object.GetType() call.
static bool ReferenceEquals(ptr const &objA, ptr const &objB)
Compares objects by reference.
Definition: object.h:115
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
String & operator+=(uint8_t value)
Concatenation assignment operator.
String(const char *str, int length)
Constructs string from character string pointer and explicit length.
char_t operator[](int index) const
Gets character at specified position.
String(const std::wstring &str)
Creates String from widestring.
Definition: string.h:1147
ArrayPtr< char_t > ToCharArray(int32_t startIndex=0, int32_t length=INT32_MAX) const
Converts string or substring to array of characters.
int IndexOfAny(const ArrayPtr< char_t > &anyOf) const
Looks for any of passed characters through the whole string. Compares first string character to all c...
String(const String &str)
Copy constructor.
static String FromAscii(const char *asciiStr, int len)
Creates String from ASCII string.
int IndexOfAny(char_t c, int startIndex=0) const
Character forward lookup.
String PadRight(int totalWidth, char_t c=u' ') const
Adds padding on the right of original string.
String(const T &value, typename std::enable_if< IsStringPointer< T, wchar_t >::value >::type *=nullptr)
Constructs string based on widecharacter string pointer. Treats pointed string as null-terminated,...
Definition: string.h:226
bool EndsWith(const String &value, bool ignoreCase, const SharedPtr< System::Globalization::CultureInfo > &culture=nullptr) const
Checks if string ends with specified substring.
String(const T &value, typename std::enable_if< IsStringPointer< T, char >::value >::type *=nullptr)
Constructs string based on character string pointer. Treats pointed string as null-terminated in UTF8...
Definition: string.h:176
std::u16string ToU16Str() const
Converts string to std::u16string.
bool operator<(const String &str) const
Order-compares strings.
ArrayPtr< String > Split(char_t separatorA, char_t separatorB, StringSplitOptions opt=StringSplitOptions::None) const
Splits string by one of two characters.
String Substring(int32_t startIndex, int32_t length) const
Extracts substring.
int IndexOf(const String &str, int startIndex=0) const
Substring forward lookup.
String TrimEnd(const String &anyOf) const
Removes all occurrences of passed characters from end of the string.
String & operator+=(int32_t value)
Concatenation assignment operator.
String & operator=(const String &str)
Assignment operator.
static String FromUtf8(const std::string &utf8)
Creates String from utf8 string.
int IndexOfAny(const String &str, int startIndex=0) const
Consequently looks for all characters of str in this. If first character is found,...
String ToLower() const
Converts all string's characters to lower case.
bool IsNormalized(System::Text::NormalizationForm form) const
Checks if unicode string is normalized using normalization form specified.
String Remove(int32_t startIndex, int32_t count=INT32_MAX) const
Extracts everything but substring from current string.
String(const std::u32string &u32str)
Creates String from std::u32string string.
String TrimStart(const String &anyOf) const
Removes all occurrences of passed characters from beginning of the string.
String & reset()
Sets string to null. Is analogous to 'string_variable_name = null' in C#.
String & Append(const char16_t *src, int32_t startIndex, int32_t count)
Puts some characters into string. Changes string size.
String & operator+=(T value)
Concatenation assignment operator.
Definition: string.h:441
uintptr_t m_state
String state. Contains value 0 if string is null, 1 if string is constructed from string literal.
Definition: string.h:1183
String & operator+=(const String &str)
Concatenation assignment operator.
String Trim(const String &anyOf) const
Removes all occurrences of passed characters from both beginning and end of the string.
~String()
Destructor.
bool Equals(const String &str) const
String equality comparison. Uses System::StringComparison::Ordinal comparison mode.
bool operator>(const String &str) const
Order-compares strings.
String TrimStart() const
Removes all whitespace characters from beginning of the string.
String & operator+=(char_t c)
Concatenation assignment operator.
bool EndsWith(const String &value) const
Checks if string ends with specified substring.
int LastIndexOf(const String &str, System::StringComparison comparison_type) const
Substring backward lookup.
String Clone() const
Creates a copy of current string.
int get_Length() const
Gets string length.
static int Compare(const String &strA, int indexA, const String &strB, int indexB, int length, bool ignoreCase, const SharedPtr< System::Globalization::CultureInfo > &ci)
Less-equal-greater-compares two substrings.
bool operator==(const String &str) const
Equality comparison operator.
String & operator+=(int64_t value)
Concatenation assignment operator.
int IndexOf(const String &str, System::StringComparison comparison_type) const
Substring forward lookup.
int GetHashCode() const
Hashes contained string. Implemented in ICU, doesn't match hashes in C#.
reverse_iterator rbegin() const
Returns reverse iterator to the last character (if any) of actual string buffer.
String ToLower(const SharedPtr< System::Globalization::CultureInfo > &cultureInfo) const
Converts all string's characters to lower case using specific culture.
String Trim(char_t ch) const
Removes all occurrences of passed character from both beginning and end of the string.
String(codeporting_icu::UnicodeString &&str) noexcept
Move constructor.
String(const std::u16string &str)
Creates String from utf16 string.
Definition: string.h:1150
static String Join(const String &separator, const SharedPtr< System::Collections::Generic::IEnumerable< String > > &parts)
Joins array using string as separator.
int LastIndexOf(char_t value, int32_t startIndex, int32_t count) const
Character backward lookup.
static String FromAscii(const std::string &asciiStr)
Creates String from ASCII string.
bool Contains(char16_t value) const
Checks if string contains given character.
String & operator=(String &&str) noexcept
Move assignment operator.
static String Format(const SharedPtr< IFormatProvider > &fp, const String &format, const Args &... args)
Formats string in C# style.
Definition: string.h:1419
int LastIndexOfAny(const ArrayPtr< char_t > &anyOf) const
Looks for any of passed characters through whole string backwardly. Compares last string character to...
Detail::UnicodeStringHolder m_str
Actual string value.
Definition: string.h:1178
static String FromUtf16(const std::u16string &u16str)
Creates String from utf16 string.
int LastIndexOf(const String &str, int startIndex, System::StringComparison comparison_type) const
Substring backward lookup.
String operator+(const T &value) const
Adds reference type object string representation to the end of the string.
Definition: string.h:373
bool Is(const System::TypeInfo &target) const
Checks if string object is of type specified by TypeInfo passed.
Definition: string.h:634
String(String &&str) noexcept
Move constructor.
String ToLowerInvariant() const
Converts all string's characters to lower case using invariant culture.
bool StartsWith(const String &value) const
Checks if string begins with specified substring.
reverse_iterator rend() const
Returns reverse iterator to the before first character (if any) of actual string buffer.
String(const wchar_t *str, int length)
Constructs string from widecharacter string pointer and explicit length. Conversion from wchar_t is t...
int IndexOf(const String &str, int startIndex, int count) const
Substring forward lookup.
static String Join(const String &separator, const ArrayPtr< String > &parts, int startIndex=0, int count=-1)
Joins array using string as separator.
static bool Equals(const String &strA, const String &strB)
Equal-compares two strings using Ordial comparison mode.
int LastIndexOfAny(const ArrayPtr< char_t > &anyOf, int32_t startindex, int32_t count) const
Looks for any of passed characters through substring backwardly. Compares last string character to al...
String & operator+=(uint32_t value)
Concatenation assignment operator.
ArrayPtr< String > Split(const String &separator, StringSplitOptions opt=StringSplitOptions::None) const
Splits string by substring.
String(const ArrayPtr< char16_t > &arr)
Converts whole character array to string.
static const String Empty
Empty string.
Definition: string.h:908
String & operator+=(int16_t value)
Concatenation assignment operator.
ArrayPtr< String > Split(const String &separator, int count, StringSplitOptions opt=StringSplitOptions::None) const
Splits string by substring.
String(const T &value, typename std::enable_if< std::is_same< T, std::nullptr_t >::value >::type *=nullptr)
Nullptr constructor. Declared as template to resolve priorities with other template constructors.
Definition: string.h:207
static String FromUtf8(const uint8_t *utf8)
Creates String from utf8 string.
String ToUpperInvariant() const
Converts all string's characters to upper case using invariant culture.
static String Copy(const String &str)
Creates string copy.
Definition: string.h:1057
ASPOSECPP_VALUE_TYPE_IMPLEMENTS_INTERFACES()
String is value type on C++ side which implicitly (without inheritance) implements some interfaces.
static const String Null
Null string.
Definition: string.h:910
String(const char16_t *str, int length)
Constructs string from character string pointer and explicit length.
bool operator==(std::nullptr_t) const
Checks if string is null. Applies same logic as IsNull() call.
String operator+(uint32_t i) const
Adds unsigned integer value string representation to the end of the string.
static bool Equals(const String &strA, const String &strB, System::StringComparison comparison_type)
Equal-compares two strings.
String(const wchar_t ch, int count=1)
Fill constructor. Conversion from wchar_t is time-consuming on some platforms, so no implicit convers...
String(const char16_t ch, int count)
Fill constructor.
String & operator+=(uint16_t value)
Concatenation assignment operator.
static int Compare(const String &strA, int indexA, const String &strB, int indexB, int length, bool ignoreCase=false)
Less-equal-greater-compares two substrings.
static bool IsNullOrEmpty(const String &str)
Checks if passed string is null or empty.
bool operator!=(std::nullptr_t) const
Checks if string is not null. Applies same logic as IsNull() call.
static int Compare(const String &strA, int indexA, const String &strB, int indexB, int length, System::StringComparison comparison_type)
Less-equal-greater-compares two strings.
String operator+(int i) const
Adds integer value string representation to the end of the string.
ArrayPtr< String > Split(char_t separator, int32_t count, StringSplitOptions opt=StringSplitOptions::None) const
Splits string by character.
String operator+(T arg) const
Adds boolean value string representation to the end of the string.
Definition: string.h:391
static int Compare(const String &strA, const String &strB, System::StringComparison comparison_type)
Less-equal-greater-compares two strings.
bool EndsWith(const String &value, System::StringComparison comparisonType) const
Checks if string ends with specified substring.
String Substring(int32_t startIndex) const
Extracts substring.
String operator+(const T &arg) const
String concatenation with string literal or character string pointer.
Definition: string.h:343
String TrimEnd(char_t ch) const
Removes all occurrences of passed character from end of the string.
const UChar * begin() const
Returns pointer to the beginning of actual string buffer. Never reallocates anything....
ArrayPtr< String > Split(const ArrayPtr< String > &separators, StringSplitOptions opt=StringSplitOptions::None) const
Splits string by substring.
int LastIndexOf(const String &str, int startIndex=INT32_MAX) const
Substring backward lookup.
std::wstring ToWCS() const
Converts string to std::wstring.
int FastToAscii(char buffer[], int buffer_size) const
Tries to convert a String to an ASCII string.
int IndexOf(const String &value, int startIndex, int count, System::StringComparison comparisonType) const
Substring forward lookup.
String TrimStart(char_t ch) const
Removes all occurrences of passed character from beginning of the string.
String Replace(char_t oldValue, char_t newValue) const
Replaces all occurrences of character in the string.
String ToUpper(const SharedPtr< System::Globalization::CultureInfo > &cultureInfo) const
Converts all string's characters to upper case using specific culture.
String(const T &value, typename std::enable_if< IsStringPointer< T, char16_t >::value >::type *=nullptr)
Constructs string based on character string pointer. Treats pointed string as null-terminated,...
Definition: string.h:158
String operator+(double d) const
Adds floating point value string representation to the end of the string.
String(const ArrayPtr< char16_t > &arr, int offset, int len)
Converts character array subrange to string. If parameters are out of array bounds,...
String ToUpper() const
Converts all string's characters to upper case.
int IndexOf(char_t c, int startIndex, int count) const
Character forward lookup in substring.
void CopyTo(int sourceIndex, const ArrayPtr< char_t > &destination, int destinationIndex, int count) const
Copies string characters into existing array elements. No resize is being done.
static int Compare(const String &strA, const String &strB, bool ignoreCase=false)
Less-equal-greater-compares two strings.
int LastIndexOfAny(const ArrayPtr< char_t > &anyOf, int32_t startindex) const
Looks for any of passed characters through substring backwardly. Compares last string character to al...
String(const char16_t *str, int start, int length)
Constructs string from character string pointer from starting position using length.
int CompareTo(const String &str) const
Compares two strings in 'less-equals-more' style. Uses current culture.
String PadLeft(int totalWidth, char_t c=u' ') const
Adds padding on the left of original string.
String TrimStart(const ArrayPtr< char_t > &anyOf) const
Removes all occurrences of passed characters from beginning of the string.
bool IsAsciiString() const
Indicates if a String contains ASCII symbols only.
ArrayPtr< String > Split(const ArrayPtr< char_t > &separators, int32_t count, StringSplitOptions opt=StringSplitOptions::None) const
Splits string by one of characters specified.
static String Concat(const String &str0, const String &str1, const String &str2, const String &str3)
Concatenates strings.
String operator+(const String &str) const
String concatenation operator.
bool IsNullOrEmpty() const
Checks if string is empty or is considered null.
static String Concat(const String &str0, const String &str1, const String &str2)
Concatenates strings.
static String Join(const String &separator, const System::Details::ArrayView< String > &parts, int startIndex=0, int count=-1)
Joins array using string as separator.
String & operator+=(double value)
Concatenation assignment operator.
static int CompareOrdinal(const String &strA, const String &strB)
Less-equal-greater-compares two strings using ordinal mode.
String(const std::string &utf8str)
Creates String from std::string string presented in format UTF-8.
std::string ToUtf8String() const
Converts string to std::string. Uses UTF-8 encoding.
static String FromUtf8(const char *utf8, int len)
Creates String from utf8 string.
bool StartsWith(const String &value, System::StringComparison comparisonType) const
Checks if string begins with specified substring.
static bool IsNullOrWhiteSpace(const String &str)
Indicates whether a specified string is null, empty, or consists only of white-space characters.
bool operator!=(const String &str) const
Non-equality comparison operator.
static String Join(const String &separator, const ArrayPtr< SharedPtr< Object > > &parts)
Joins array using string as separator.
String operator+(char_t x) const
Adds character to the end of the string.
String TrimEnd() const
Removes all whitespace characters from end of the string.
ArrayPtr< String > Split(const ArrayPtr< char_t > &separators, StringSplitOptions opt=StringSplitOptions::None) const
Splits string by one of characters specified.
bool Equals(const String &str, System::StringComparison comparison_type) const
String equality comparison. Several modes provided by StringComparison enumeration are supported.
const UChar * end() const
Returns pointer to the end of actual string buffer. Never reallocates anything. Doesn't guarantee buf...
String ToString(const SharedPtr< IFormatProvider > &) const
Wrapper for handling String class in contexts where ToString() is being called on value type objects.
Definition: string.h:507
const UChar * u_str() const
Returns ICU-styled null-terminated buffer. May reallocate the string.
ArrayPtr< String > Split(const ArrayPtr< String > &separators, int count, StringSplitOptions opt=StringSplitOptions::None) const
Splits string by substring. Currently, only supports separators array of zero or one elements.
static String Concat(const String &str0, const String &str1)
Concatenates strings.
String ToString() const
Wrapper for handling String class in contexts where ToString() is being called on value type objects.
Definition: string.h:504
String Trim() const
Removes all whitespace characters from both beginning and end of the string.
static int CompareOrdinal(const String &strA, int indexA, const String &strB, int indexB, int length)
Less-equal-greater-compares two strings using ordinal mode.
String operator+(int64_t v) const
Adds integer value string representation to the end of the string.
int IndexOf(char_t c, int startIndex=0) const
Character forward lookup.
ArrayPtr< uint8_t > ToByteArray(int32_t startIndex=0, int32_t length=INT32_MAX, bool LE=true) const
Converts string or substring to array of bytes.
std::u32string ToU32Str() const
Converts string to std::u32string.
int IndexOfAny(const ArrayPtr< char_t > &anyOf, int32_t startindex) const
Looks for any of passed characters through substring. Compares first string character to all characte...
String TrimEnd(const ArrayPtr< char_t > &anyOf) const
Removes all occurrences of passed characters from end of the string.
static String FromUtf32(const uint32_t *utf32, int32_t length)
Creates String from utf32 string.
String(T &value, typename std::enable_if< IsStringLiteral< T, char >::value >::type *=nullptr)
Constructs string based on string literal. Considers literal a null-terminated string in UTF8,...
Definition: string.h:167
int IndexOf(const String &str, int startIndex, System::StringComparison comparison_type) const
Substring forward lookup.
static String FromWCS(const std::wstring &wcs)
Creates String from widestring.
bool IsEmpty() const
Checks if string is both non-null and empty.
int IndexOfAny(const ArrayPtr< char_t > &anyOf, int32_t startindex, int32_t count) const
Looks for any of passed characters through substring. Compares first string character to all characte...
String & operator+=(uint64_t value)
Concatenation assignment operator.
String Insert(int startIndex, const String &value) const
Inserts substring at specified position.
bool Contains(const String &str) const
Checks if str is a substring of current string.
static String FromAscii(const char *asciiStr)
Creates String from ASCII string.
String & SetCharAt(int index, char_t ch)
Sets character at specified position.
int LastIndexOf(char_t value) const
Character backward lookup.
ArrayPtr< String > Split(char_t separator=u' ', StringSplitOptions opt=StringSplitOptions::None) const
Splits string by character.
bool StartsWith(const String &value, bool ignoreCase, const SharedPtr< System::Globalization::CultureInfo > &culture=nullptr) const
Checks if string begins with specified substring.
static String FromUtf8(const char *utf8)
Creates String from utf8 string.
bool IsNull() const
Checks if string is considered null. String is null and only if it is constructed via String() constr...
Definition: string.h:285
std::reverse_iterator< const char16_t * > reverse_iterator
Reverse iterator type.
Definition: string.h:140
String(T &value, typename std::enable_if< IsStringLiteral< T, wchar_t >::value >::type *=nullptr)
Constructs string based on widestring literal. Considers literal a null-terminated string,...
Definition: string.h:218
String Replace(const String &oldValue, const String &newValue) const
Replaces all occurrences of lookup in this string.
String()
Default constructor. Creates string object which is considered null.
String(const codeporting_icu::UnicodeString &str)
Wraps UnicodeString into String.
static String Concat(const ArrayPtr< String > &parts)
Concatenates strings.
String Normalize(System::Text::NormalizationForm form) const
Normalizes unicode string using normalization form specified.
String Trim(const ArrayPtr< char_t > &anyOf) const
Removes all occurrences of passed characters from both beginning and end of the string.
static int Compare(const String &strA, const String &strB, bool ignoreCase, const SharedPtr< System::Globalization::CultureInfo > &ci)
Less-equal-greater-compares two strings.
int LastIndexOf(const String &value, int startIndex, int count, StringComparison comparisonType) const
Substring backward lookup.
String(T &value, typename std::enable_if< IsStringLiteral< T, char16_t >::value >::type *=nullptr)
Constructs string based on string literal. Considers literal a null-terminated string,...
Definition: string.h:151
std::string ToAsciiString() const
Converts string to std::string. Uses ASCII encoding.
int LastIndexOf(char_t value, int32_t startIndex) const
Character backward lookup.
Regular expression that follows C#-like syntax. Objects of this class should only be allocated using ...
Definition: regex.h:30
Buffer to accumulate string part by part. This type can be allocated either in stack as value type or...
Definition: string_builder.h:17
Represents a particular type and provides information about it.
Definition: type_info.h:109
@ Text
Defines color adjustment information for text.
NormalizationForm
Defines how to normalize Unicode string.
Definition: normalization_form.h:9
Definition: db_command.h:9
void PrintTo(DateTime value, std::ostream *stream)
Prints value to ostream. Mostly used for debug.
bool operator!=(ArraySegment< T > a, ArraySegment< T > b)
Definition: array_segment.h:156
Decimal operator+(const T &x, const Decimal &d)
Returns a new instance of Decimal class that represents a value that is a sum of the specified value ...
Definition: decimal.h:542
std::istream & operator>>(std::istream &in, String &str)
Gets a string from the input streamusing UTF-8 encoding.
StringComparison
Defines string comparison style.
Definition: string_comparison.h:13
StringSplitOptions
Determines string splitting behavior.
Definition: string.h:54
@ None
Keep empty strings when splitting string.
@ RemoveEmptyEntries
Discard empty strings when splitting string.
std::ostream & operator<<(std::ostream &stream, DateTime date_time)
Insert data into the stream using UTF-8 encoding.
Definition: date_time.h:729
bool operator==(ArraySegment< T > a, ArraySegment< T > b)
Definition: array_segment.h:150
Template magic to deduce cast results.
Definition: object.h:385
SmartPtr< TTo > type
An alias for a pointer to an instance of TTo.
Definition: object.h:387
Template magic to check if a type is a sequence of string characters.
Definition: string.h:68
Template magic to check if a type is a string literal.
Definition: string.h:82
Template magic to check if a type is a pointer to character string.
Definition: string.h:75