17 [__DynamicallyInvokable]
21 private int m_stringLength;
24 private char m_firstChar;
26 private const int TrimHead = 0;
28 private const int TrimTail = 1;
30 private const int TrimBoth = 2;
33 [__DynamicallyInvokable]
34 public static readonly
string Empty;
36 private const int charPtrAlignConst = 3;
38 private const int alignConst = 7;
40 internal char FirstChar => m_firstChar;
47 [IndexerName(
"Chars")]
48 [__DynamicallyInvokable]
49 public char this[
int index]
52 [SecuritySafeCritical]
53 [__DynamicallyInvokable]
59 [__DynamicallyInvokable]
63 [SecuritySafeCritical]
64 [__DynamicallyInvokable]
74 [__DynamicallyInvokable]
75 public static string Join(
string separator, params
string[] value)
81 return Join(separator, value, 0, value.Length);
91 [__DynamicallyInvokable]
92 public static string Join(
string separator, params
object[] values)
98 if (values.Length == 0 || values[0] ==
null)
102 if (separator ==
null)
110 stringBuilder.
Append(text);
112 for (
int i = 1; i < values.Length; i++)
114 stringBuilder.
Append(separator);
115 if (values[i] !=
null)
120 stringBuilder.
Append(text);
124 return StringBuilderCache.GetStringAndRelease(stringBuilder);
135 [__DynamicallyInvokable]
142 if (separator ==
null)
148 if (!enumerator.MoveNext())
153 if (enumerator.
Current !=
null)
155 string text = enumerator.
Current.ToString();
158 stringBuilder.
Append(text);
161 while (enumerator.MoveNext())
163 stringBuilder.
Append(separator);
164 if (enumerator.
Current !=
null)
166 string text2 = enumerator.
Current.ToString();
169 stringBuilder.
Append(text2);
173 return StringBuilderCache.GetStringAndRelease(stringBuilder);
184 [__DynamicallyInvokable]
191 if (separator ==
null)
202 if (enumerator.
Current !=
null)
208 stringBuilder.
Append(separator);
209 if (enumerator.
Current !=
null)
214 return StringBuilderCache.GetStringAndRelease(stringBuilder);
231 [SecuritySafeCritical]
232 [__DynamicallyInvokable]
233 public unsafe
static string Join(
string separator,
string[] value,
int startIndex,
int count)
247 if (startIndex > value.Length - count)
251 if (separator ==
null)
260 int num2 = startIndex + count - 1;
261 for (
int i = startIndex; i <= num2; i++)
263 if (value[i] !=
null)
265 num += value[i].Length;
268 num += (count - 1) * separator.Length;
269 if (num < 0 || num + 1 < 0)
277 string text = FastAllocateString(num);
278 fixed (
char* buffer = &text.m_firstChar)
280 UnSafeCharBuffer unSafeCharBuffer =
new UnSafeCharBuffer(buffer, num);
281 unSafeCharBuffer.AppendString(value[startIndex]);
282 for (
int j = startIndex + 1; j <= num2; j++)
284 unSafeCharBuffer.AppendString(separator);
285 unSafeCharBuffer.AppendString(value[j]);
291 [SecuritySafeCritical]
292 private unsafe
static int CompareOrdinalIgnoreCaseHelper(
string strA,
string strB)
294 int num =
Math.
Min(strA.Length, strB.Length);
295 fixed (
char* ptr = &strA.m_firstChar)
297 fixed (
char* ptr3 = &strB.m_firstChar)
305 if ((uint)(num2 - 97) <= 25u)
309 if ((uint)(num3 - 97) <= 25u)
321 return strA.Length - strB.Length;
328 internal static extern int nativeCompareOrdinalEx(
string strA,
int indexA,
string strB,
int indexB,
int count);
332 internal unsafe
static extern int nativeCompareOrdinalIgnoreCaseWC(
string strA, sbyte* strBBytes);
334 [SecuritySafeCritical]
335 internal unsafe
static string SmallCharToUpper(
string strIn)
337 int length = strIn.Length;
338 string text = FastAllocateString(length);
339 fixed (
char* ptr = &strIn.m_firstChar)
341 fixed (
char* ptr2 = &text.m_firstChar)
343 for (
int i = 0; i < length; i++)
346 if ((uint)(num - 97) <= 25u)
357 [SecuritySafeCritical]
358 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.MayFail)]
359 private unsafe
static bool EqualsHelper(
string strA,
string strB)
361 int num = strA.Length;
362 fixed (
char* ptr = &strA.m_firstChar)
364 fixed (
char* ptr3 = &strB.m_firstChar)
370 if (*(
long*)ptr2 != *(
long*)ptr4)
374 if (*(
long*)(ptr2 + 4) != *(
long*)(ptr4 + 4))
378 if (*(
long*)(ptr2 + 8) != *(
long*)(ptr4 + 8))
386 while (num > 0 && *(
int*)ptr2 == *(
int*)ptr4)
397 [SecuritySafeCritical]
398 private unsafe
static int CompareOrdinalHelper(
string strA,
string strB)
400 int num = Math.Min(strA.Length, strB.Length);
402 fixed (
char* ptr = &strA.m_firstChar)
404 fixed (
char* ptr3 = &strB.m_firstChar)
410 if (*(
int*)ptr2 != *(
int*)ptr4)
415 if (*(
int*)(ptr2 + 2) != *(
int*)(ptr4 + 2))
420 if (*(
int*)(ptr2 + 4) != *(
int*)(ptr4 + 4))
425 if (*(
int*)(ptr2 + 6) != *(
int*)(ptr4 + 6))
430 if (*(
int*)(ptr2 + 8) != *(
int*)(ptr4 + 8))
444 if ((result = *ptr2 - *ptr4) != 0)
448 return ptr2[1] - ptr4[1];
450 while (num > 0 && *(
int*)ptr2 == *(
int*)ptr4)
459 if ((result2 = *ptr2 - *ptr4) != 0)
463 return ptr2[1] - ptr4[1];
465 return strA.Length - strB.Length;
474 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.MayFail)]
475 [__DynamicallyInvokable]
482 string text = obj as string;
491 if (
Length != text.Length)
495 return EqualsHelper(
this, text);
502 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.MayFail)]
503 [__DynamicallyInvokable]
514 if ((
object)
this == value)
518 if (
Length != value.Length)
522 return EqualsHelper(
this, value);
532 [SecuritySafeCritical]
533 [__DynamicallyInvokable]
536 if (comparisonType < StringComparison.CurrentCulture || comparisonType >
StringComparison.OrdinalIgnoreCase)
540 if ((
object)
this == value)
548 switch (comparisonType)
559 if (
Length != value.Length)
563 return EqualsHelper(
this, value);
565 if (
Length != value.Length)
569 if (IsAscii() && value.IsAscii())
571 return CompareOrdinalIgnoreCaseHelper(
this, value) == 0;
573 return TextInfo.CompareOrdinalIgnoreCase(
this, value) == 0;
584 [__DynamicallyInvokable]
585 public static bool Equals(
string a,
string b)
591 if (a ==
null || b ==
null)
595 if (a.Length != b.Length)
599 return EqualsHelper(a, b);
610 [SecuritySafeCritical]
611 [__DynamicallyInvokable]
614 if (comparisonType < StringComparison.CurrentCulture || comparisonType >
StringComparison.OrdinalIgnoreCase)
622 if (a ==
null || b ==
null)
626 switch (comparisonType)
637 if (a.Length != b.Length)
641 return EqualsHelper(a, b);
643 if (a.Length != b.Length)
647 if (a.IsAscii() && b.IsAscii())
649 return CompareOrdinalIgnoreCaseHelper(a, b) == 0;
651 return TextInfo.CompareOrdinalIgnoreCase(a, b) == 0;
662 [__DynamicallyInvokable]
673 [__DynamicallyInvokable]
692 [SecuritySafeCritical]
693 [__DynamicallyInvokable]
694 public unsafe
void CopyTo(
int sourceIndex,
char[] destination,
int destinationIndex,
int count)
696 if (destination ==
null)
708 if (count >
Length - sourceIndex)
712 if (destinationIndex > destination.Length - count || destinationIndex < 0)
718 fixed (
char* ptr2 = &m_firstChar)
720 fixed (
char* ptr = destination)
722 wstrcpy(ptr + destinationIndex, ptr2 + sourceIndex, count);
730 [SecuritySafeCritical]
731 [__DynamicallyInvokable]
735 char[] array =
new char[length];
738 fixed (
char* smem = &m_firstChar)
740 char[] array2 = array;
741 fixed (
char* dmem = array2)
743 wstrcpy(dmem, smem, length);
757 [SecuritySafeCritical]
758 [__DynamicallyInvokable]
761 if (startIndex < 0 || startIndex >
Length || startIndex >
Length - length)
769 char[] array =
new char[length];
772 fixed (
char* ptr = &m_firstChar)
774 char[] array2 = array;
775 fixed (
char* dmem = array2)
777 wstrcpy(dmem, ptr + startIndex, length);
788 [__DynamicallyInvokable]
793 return value.Length == 0;
802 [__DynamicallyInvokable]
809 for (
int i = 0; i < value.Length; i++)
811 if (!
char.IsWhiteSpace(value[i]))
821 internal static extern int InternalMarvin32HashString(
string s,
int strLen,
long additionalEntropy);
823 [SecuritySafeCritical]
824 internal static bool UseRandomizedHashing()
826 return InternalUseRandomizedHashing();
831 [SuppressUnmanagedCodeSecurity]
832 private static extern bool InternalUseRandomizedHashing();
836 [SecuritySafeCritical]
837 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.MayFail)]
838 [__DynamicallyInvokable]
841 if (HashHelpers.s_UseRandomizedStringHashing)
843 return InternalMarvin32HashString(
this,
Length, 0
L);
845 fixed (
char* ptr =
this)
851 while ((num3 = *ptr2) != 0)
853 num = (((num << 5) + num) ^ num3);
859 num2 = (((num2 << 5) + num2) ^ num3);
862 return num + num2 * 1566083941;
866 [SecuritySafeCritical]
867 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.MayFail)]
868 internal unsafe
int GetLegacyNonRandomizedHashCode()
870 fixed (
char* ptr =
this)
876 while ((num3 = *ptr2) != 0)
878 num = (((num << 5) + num) ^ num3);
884 num2 = (((num2 << 5) + num2) ^ num3);
887 return num + num2 * 1566083941;
894 [__DynamicallyInvokable]
895 public string[]
Split(params
char[] separator)
906 [__DynamicallyInvokable]
907 public string[]
Split(
char[] separator,
int count)
920 [__DynamicallyInvokable]
923 return SplitInternal(separator,
int.MaxValue, options);
937 [__DynamicallyInvokable]
940 return SplitInternal(separator, count, options);
944 internal string[] SplitInternal(
char[] separator,
int count,
StringSplitOptions options)
950 if (options < StringSplitOptions.None || options >
StringSplitOptions.RemoveEmptyEntries)
952 throw new ArgumentException(Environment.GetResourceString(
"Arg_EnumIllegalVal", options));
955 if (count == 0 || (flag &&
Length == 0))
957 return new string[0];
959 int[] sepList =
new int[
Length];
960 int num = MakeSeparatorList(separator, ref sepList);
961 if (num == 0 || count == 1)
970 return InternalSplitOmitEmptyEntries(sepList,
null, num, count);
972 return InternalSplitKeepEmptyEntries(sepList,
null, num, count);
983 [__DynamicallyInvokable]
986 return Split(separator,
int.MaxValue, options);
1000 [__DynamicallyInvokable]
1007 if (options < StringSplitOptions.None || options >
StringSplitOptions.RemoveEmptyEntries)
1012 if (separator ==
null || separator.Length == 0)
1014 return SplitInternal(
null, count, options);
1016 if (count == 0 || (flag &&
Length == 0))
1018 return new string[0];
1020 int[] sepList =
new int[
Length];
1021 int[] lengthList =
new int[
Length];
1022 int num = MakeSeparatorList(separator, ref sepList, ref lengthList);
1023 if (num == 0 || count == 1)
1025 return new string[1]
1032 return InternalSplitOmitEmptyEntries(sepList, lengthList, num, count);
1034 return InternalSplitKeepEmptyEntries(sepList, lengthList, num, count);
1037 private string[] InternalSplitKeepEmptyEntries(
int[] sepList,
int[] lengthList,
int numReplaces,
int count)
1042 int num3 = (numReplaces < count) ? numReplaces : count;
1043 string[] array =
new string[num3 + 1];
1044 for (
int i = 0; i < num3; i++)
1050 array[num2++] =
Substring(num, sepList[i] - num);
1051 num = sepList[i] + ((lengthList ==
null) ? 1 : lengthList[i]);
1053 if (num < Length && num3 >= 0)
1057 else if (num2 == num3)
1059 array[num2] =
Empty;
1064 private string[] InternalSplitOmitEmptyEntries(
int[] sepList,
int[] lengthList,
int numReplaces,
int count)
1066 int num = (numReplaces < count) ? (numReplaces + 1) : count;
1067 string[] array =
new string[num];
1070 for (
int i = 0; i < numReplaces; i++)
1076 if (sepList[i] - num2 > 0)
1078 array[num3++] =
Substring(num2, sepList[i] - num2);
1080 num2 = sepList[i] + ((lengthList ==
null) ? 1 : lengthList[i]);
1081 if (num3 == count - 1)
1083 while (i < numReplaces - 1 && num2 == sepList[++i])
1085 num2 += ((lengthList ==
null) ? 1 : lengthList[i]);
1094 string[] array2 = array;
1097 array2 =
new string[num3];
1098 for (
int j = 0; j < num3; j++)
1100 array2[j] = array[j];
1106 [SecuritySafeCritical]
1107 private unsafe
int MakeSeparatorList(
char[] separator, ref
int[] sepList)
1110 if (separator ==
null || separator.Length == 0)
1112 fixed (
char* ptr = &m_firstChar)
1114 for (
int i = 0; i <
Length; i++)
1116 if (num >= sepList.Length)
1120 if (
char.IsWhiteSpace(ptr[i]))
1129 int num3 = sepList.Length;
1130 int num4 = separator.Length;
1131 fixed (
char* ptr4 = &m_firstChar)
1133 fixed (
char* ptr2 = separator)
1135 for (
int j = 0; j <
Length; j++)
1145 if (ptr4[j] == *ptr3)
1160 [SecuritySafeCritical]
1161 private unsafe
int MakeSeparatorList(
string[] separators, ref
int[] sepList, ref
int[] lengthList)
1164 int num2 = sepList.Length;
1165 int num3 = separators.Length;
1166 fixed (
char* ptr = &m_firstChar)
1168 for (
int i = 0; i <
Length; i++)
1174 foreach (
string text
in separators)
1178 int length = text.Length;
1179 if (ptr[i] == text[0] && length <=
Length - i && (length == 1 ||
CompareOrdinal(
this, i, text, 0, length) == 0))
1182 lengthList[num] = length;
1199 [__DynamicallyInvokable]
1212 [SecuritySafeCritical]
1213 [__DynamicallyInvokable]
1228 if (startIndex >
Length - length)
1236 if (startIndex == 0 && length ==
Length)
1240 return InternalSubString(startIndex, length);
1244 private unsafe
string InternalSubString(
int startIndex,
int length)
1246 string text = FastAllocateString(length);
1247 fixed (
char* dmem = &text.m_firstChar)
1249 fixed (
char* ptr = &m_firstChar)
1251 wstrcpy(dmem, ptr + startIndex, length);
1260 [__DynamicallyInvokable]
1261 public string Trim(params
char[] trimChars)
1263 if (trimChars ==
null || trimChars.Length == 0)
1265 return TrimHelper(2);
1267 return TrimHelper(trimChars, 2);
1273 [__DynamicallyInvokable]
1276 if (trimChars ==
null || trimChars.Length == 0)
1278 return TrimHelper(0);
1280 return TrimHelper(trimChars, 0);
1286 [__DynamicallyInvokable]
1289 if (trimChars ==
null || trimChars.Length == 0)
1291 return TrimHelper(1);
1293 return TrimHelper(trimChars, 1);
1303 [CLSCompliant(
false)]
1304 public unsafe
extern String(
char* value);
1316 [CLSCompliant(
false)]
1317 public unsafe
extern String(
char* value,
int startIndex,
int length);
1329 [CLSCompliant(
false)]
1330 public unsafe
extern String(sbyte* value);
1345 [CLSCompliant(
false)]
1346 public unsafe
extern String(sbyte* value,
int startIndex,
int length);
1362 [CLSCompliant(
false)]
1363 public unsafe
extern String(sbyte* value,
int startIndex,
int length,
Encoding enc);
1366 private unsafe
static string CreateString(sbyte* value,
int startIndex,
int length,
Encoding enc)
1370 return new string(value, startIndex, length);
1374 throw new ArgumentOutOfRangeException(
"length", Environment.GetResourceString(
"ArgumentOutOfRange_NeedNonNegNum"));
1378 throw new ArgumentOutOfRangeException(
"startIndex", Environment.GetResourceString(
"ArgumentOutOfRange_StartIndex"));
1380 if (value + startIndex < value)
1382 throw new ArgumentOutOfRangeException(
"startIndex", Environment.GetResourceString(
"ArgumentOutOfRange_PartialWCHAR"));
1384 byte[] array =
new byte[length];
1387 Buffer.Memcpy(array, 0, (
byte*)value, startIndex, length);
1389 catch (NullReferenceException)
1391 throw new ArgumentOutOfRangeException(
"value", Environment.GetResourceString(
"ArgumentOutOfRange_PartialWCHAR"));
1397 internal unsafe
static string CreateStringFromEncoding(
byte* bytes,
int byteLength,
Encoding encoding)
1399 int charCount = encoding.
GetCharCount(bytes, byteLength,
null);
1404 string text = FastAllocateString(charCount);
1405 fixed (
char* chars = &text.m_firstChar)
1407 int chars2 = encoding.
GetChars(bytes, byteLength, chars, charCount,
null);
1412 [SecuritySafeCritical]
1413 internal unsafe
int GetBytesFromEncoding(
byte* pbNativeBuffer,
int cbNativeBuffer,
Encoding encoding)
1415 fixed (
char* chars = &m_firstChar)
1417 return encoding.
GetBytes(chars, m_stringLength, pbNativeBuffer, cbNativeBuffer);
1421 [SecuritySafeCritical]
1422 internal unsafe
int ConvertToAnsi(
byte* pbNativeBuffer,
int cbNativeBuffer,
bool fBestFit,
bool fThrowOnUnmappableChar)
1424 uint flags = (!fBestFit) ? 1024u : 0u;
1427 fixed (
char* pwzSource = &m_firstChar)
1429 num2 = Win32Native.WideCharToMultiByte(0u, flags, pwzSource,
Length, pbNativeBuffer, cbNativeBuffer, IntPtr.Zero, fThrowOnUnmappableChar ?
new IntPtr(&num) : IntPtr.Zero);
1433 throw new ArgumentException(Environment.GetResourceString(
"Interop_Marshal_Unmappable_Char"));
1435 pbNativeBuffer[num2] = 0;
1453 [SecuritySafeCritical]
1460 return Normalization.IsNormalized(
this, normalizationForm);
1475 [SecuritySafeCritical]
1482 return Normalization.Normalize(
this, normalizationForm);
1487 internal static extern string FastAllocateString(
int length);
1489 [SecuritySafeCritical]
1490 private unsafe
static void FillStringChecked(
string dest,
int destPos,
string src)
1492 if (src.Length > dest.Length - destPos)
1496 fixed (
char* ptr = &dest.m_firstChar)
1498 fixed (
char* smem = &src.m_firstChar)
1500 wstrcpy(ptr + destPos, smem, src.Length);
1514 [SecuritySafeCritical]
1515 [__DynamicallyInvokable]
1516 public extern String(
char[] value,
int startIndex,
int length);
1521 [SecuritySafeCritical]
1522 [__DynamicallyInvokable]
1523 public extern String(
char[] value);
1526 internal unsafe
static void wstrcpy(
char* dmem,
char* smem,
int charCount)
1528 Buffer.Memcpy((
byte*)dmem, (
byte*)smem, charCount * 2);
1531 [SecuritySafeCritical]
1532 private unsafe
string CtorCharArray(
char[] value)
1534 if (value !=
null && value.Length != 0)
1536 string text = FastAllocateString(value.Length);
1537 fixed (
char* dmem = text)
1539 fixed (
char* smem = value)
1541 wstrcpy(dmem, smem, value.Length);
1549 [SecuritySafeCritical]
1550 private unsafe
string CtorCharArrayStartLength(
char[] value,
int startIndex,
int length)
1554 throw new ArgumentNullException(
"value");
1558 throw new ArgumentOutOfRangeException(
"startIndex", Environment.GetResourceString(
"ArgumentOutOfRange_StartIndex"));
1562 throw new ArgumentOutOfRangeException(
"length", Environment.GetResourceString(
"ArgumentOutOfRange_NegativeLength"));
1564 if (startIndex > value.Length - length)
1566 throw new ArgumentOutOfRangeException(
"startIndex", Environment.GetResourceString(
"ArgumentOutOfRange_Index"));
1570 string text = FastAllocateString(length);
1571 fixed (
char* dmem = text)
1573 fixed (
char* ptr = value)
1575 wstrcpy(dmem, ptr + startIndex, length);
1583 [SecuritySafeCritical]
1584 private unsafe
string CtorCharCount(
char c,
int count)
1588 string text = FastAllocateString(count);
1591 fixed (
char* ptr = text)
1594 while (((
int)ptr2 & 3) != 0 && count > 0)
1596 char* intPtr = ptr2;
1601 uint num = ((uint)c << 16) | c;
1608 *(uint*)(ptr2 + 2) = num;
1614 if ((count & 2) != 0)
1619 if ((count & 1) != 0)
1631 throw new ArgumentOutOfRangeException(
"count", Environment.GetResourceString(
"ArgumentOutOfRange_MustBeNonNegNum",
"count"));
1635 private unsafe
static int wcslen(
char* ptr)
1638 for (ptr2 = ptr; ((int)ptr2 & 3) != 0 && *ptr2 != 0; ptr2++)
1643 for (; (*ptr2 & ptr2[1]) != 0 || (*ptr2 != 0 && ptr2[1] != 0); ptr2 += 2)
1647 for (; *ptr2 != 0; ptr2++)
1650 return (
int)(ptr2 - ptr);
1654 private unsafe
string CtorCharPtr(
char* ptr)
1660 if ((ulong)ptr < 64000uL)
1662 throw new ArgumentException(Environment.GetResourceString(
"Arg_MustBeStringPtrNotAtom"));
1666 int num = wcslen(ptr);
1671 string text = FastAllocateString(num);
1674 fixed (
char* dmem = text)
1676 wstrcpy(dmem, ptr, num);
1684 catch (NullReferenceException)
1686 throw new ArgumentOutOfRangeException(
"ptr", Environment.GetResourceString(
"ArgumentOutOfRange_PartialWCHAR"));
1691 private unsafe
string CtorCharPtrStartLength(
char* ptr,
int startIndex,
int length)
1695 throw new ArgumentOutOfRangeException(
"length", Environment.GetResourceString(
"ArgumentOutOfRange_NegativeLength"));
1699 throw new ArgumentOutOfRangeException(
"startIndex", Environment.GetResourceString(
"ArgumentOutOfRange_StartIndex"));
1701 char* ptr2 = ptr + startIndex;
1704 throw new ArgumentOutOfRangeException(
"startIndex", Environment.GetResourceString(
"ArgumentOutOfRange_PartialWCHAR"));
1710 string text = FastAllocateString(length);
1715 fixed (
char* dmem = text)
1717 wstrcpy(dmem, ptr2, length);
1725 catch (NullReferenceException)
1727 throw new ArgumentOutOfRangeException(
"ptr", Environment.GetResourceString(
"ArgumentOutOfRange_PartialWCHAR"));
1737 [SecuritySafeCritical]
1738 [__DynamicallyInvokable]
1739 public extern String(
char c,
int count);
1748 [__DynamicallyInvokable]
1749 public static int Compare(
string strA,
string strB)
1763 [__DynamicallyInvokable]
1764 public static int Compare(
string strA,
string strB,
bool ignoreCase)
1785 [SecuritySafeCritical]
1786 [__DynamicallyInvokable]
1789 if ((uint)(comparisonType - 0) > 5u)
1793 if ((
object)strA == strB)
1805 switch (comparisonType)
1816 if (strA.m_firstChar - strB.m_firstChar != 0)
1818 return strA.m_firstChar - strB.m_firstChar;
1820 return CompareOrdinalHelper(strA, strB);
1822 if (strA.IsAscii() && strB.IsAscii())
1824 return CompareOrdinalIgnoreCaseHelper(strA, strB);
1826 return TextInfo.CompareOrdinalIgnoreCase(strA, strB);
1845 [__DynamicallyInvokable]
1848 if (culture ==
null)
1869 if (culture ==
null)
1891 [__DynamicallyInvokable]
1892 public static int Compare(
string strA,
int indexA,
string strB,
int indexB,
int length)
1896 if (strA !=
null && strA.Length - indexA < num)
1898 num = strA.Length - indexA;
1900 if (strB !=
null && strB.Length - indexB < num2)
1902 num2 = strB.Length - indexB;
1920 public static int Compare(
string strA,
int indexA,
string strB,
int indexB,
int length,
bool ignoreCase)
1924 if (strA !=
null && strA.Length - indexA < num)
1926 num = strA.Length - indexA;
1928 if (strB !=
null && strB.Length - indexB < num2)
1930 num2 = strB.Length - indexB;
1955 public static int Compare(
string strA,
int indexA,
string strB,
int indexB,
int length,
bool ignoreCase,
CultureInfo culture)
1957 if (culture ==
null)
1963 if (strA !=
null && strA.Length - indexA < num)
1965 num = strA.Length - indexA;
1967 if (strB !=
null && strB.Length - indexB < num2)
1969 num2 = strB.Length - indexB;
1997 if (culture ==
null)
2003 if (strA !=
null && strA.Length - indexA < num)
2005 num = strA.Length - indexA;
2007 if (strB !=
null && strB.Length - indexB < num2)
2009 num2 = strB.Length - indexB;
2028 [SecuritySafeCritical]
2029 [__DynamicallyInvokable]
2032 if (comparisonType < StringComparison.CurrentCulture || comparisonType >
StringComparison.OrdinalIgnoreCase)
2036 if (strA ==
null || strB ==
null)
2038 if ((
object)strA == strB)
2060 if (strA.Length - indexA < 0)
2064 if (strB.Length - indexB < 0)
2068 if (length == 0 || (strA == strB && indexA == indexB))
2074 if (strA !=
null && strA.Length - indexA < num)
2076 num = strA.Length - indexA;
2078 if (strB !=
null && strB.Length - indexB < num2)
2080 num2 = strB.Length - indexB;
2082 switch (comparisonType)
2093 return nativeCompareOrdinalEx(strA, indexA, strB, indexB, length);
2095 return TextInfo.CompareOrdinalIgnoreCaseEx(strA, indexA, strB, indexB, num, num2);
2113 if (!(value is
string))
2124 [__DynamicallyInvokable]
2141 [__DynamicallyInvokable]
2144 if ((
object)strA == strB)
2156 if (strA.m_firstChar - strB.m_firstChar != 0)
2158 return strA.m_firstChar - strB.m_firstChar;
2160 return CompareOrdinalHelper(strA, strB);
2174 [SecuritySafeCritical]
2175 [__DynamicallyInvokable]
2176 public static int CompareOrdinal(
string strA,
int indexA,
string strB,
int indexB,
int length)
2178 if (strA ==
null || strB ==
null)
2180 if ((
object)strA == strB)
2190 return nativeCompareOrdinalEx(strA, indexA, strB, indexB, length);
2199 [__DynamicallyInvokable]
2211 [__DynamicallyInvokable]
2226 [SecuritySafeCritical]
2228 [__DynamicallyInvokable]
2235 if (comparisonType < StringComparison.CurrentCulture || comparisonType >
StringComparison.OrdinalIgnoreCase)
2239 if ((
object)
this == value)
2243 if (value.Length == 0)
2247 switch (comparisonType)
2258 if (
Length >= value.Length)
2260 return nativeCompareOrdinalEx(
this,
Length - value.Length, value, 0, value.Length) == 0;
2264 if (
Length >= value.Length)
2266 return TextInfo.CompareOrdinalIgnoreCaseEx(
this,
Length - value.Length, value, 0, value.Length, value.Length) == 0;
2289 if ((
object)
this == value)
2300 if (length != 0 &&
this[length - 1] == value)
2310 [__DynamicallyInvokable]
2322 [__DynamicallyInvokable]
2338 [SecuritySafeCritical]
2339 [__DynamicallyInvokable]
2340 public extern int IndexOf(
char value,
int startIndex,
int count);
2347 [__DynamicallyInvokable]
2362 [__DynamicallyInvokable]
2379 [SecuritySafeCritical]
2380 [__DynamicallyInvokable]
2381 public extern int IndexOfAny(
char[] anyOf,
int startIndex,
int count);
2388 [__DynamicallyInvokable]
2402 [__DynamicallyInvokable]
2419 [__DynamicallyInvokable]
2420 public int IndexOf(
string value,
int startIndex,
int count)
2422 if (startIndex < 0 || startIndex >
Length)
2426 if (count < 0 || count >
Length - startIndex)
2441 [__DynamicallyInvokable]
2458 [__DynamicallyInvokable]
2461 return IndexOf(value, startIndex,
Length - startIndex, comparisonType);
2478 [SecuritySafeCritical]
2479 [__DynamicallyInvokable]
2486 if (startIndex < 0 || startIndex >
Length)
2490 if (count < 0 || startIndex >
Length - count)
2494 switch (comparisonType)
2507 if (value.IsAscii() && IsAscii())
2511 return TextInfo.IndexOfStringOrdinalIgnoreCase(
this, value, startIndex, count);
2520 [__DynamicallyInvokable]
2532 [__DynamicallyInvokable]
2535 return LastIndexOf(value, startIndex, startIndex + 1);
2547 [SecuritySafeCritical]
2548 [__DynamicallyInvokable]
2549 public extern int LastIndexOf(
char value,
int startIndex,
int count);
2556 [__DynamicallyInvokable]
2570 [__DynamicallyInvokable]
2587 [SecuritySafeCritical]
2588 [__DynamicallyInvokable]
2589 public extern int LastIndexOfAny(
char[] anyOf,
int startIndex,
int count);
2596 [__DynamicallyInvokable]
2610 [__DynamicallyInvokable]
2628 [__DynamicallyInvokable]
2646 [__DynamicallyInvokable]
2663 [__DynamicallyInvokable]
2666 return LastIndexOf(value, startIndex, startIndex + 1, comparisonType);
2684 [SecuritySafeCritical]
2685 [__DynamicallyInvokable]
2692 if (
Length == 0 && (startIndex == -1 || startIndex == 0))
2694 if (value.Length != 0)
2700 if (startIndex < 0 || startIndex >
Length)
2704 if (startIndex ==
Length)
2711 if (value.Length == 0 && count >= 0 && startIndex - count + 1 >= 0)
2716 if (count < 0 || startIndex - count + 1 < 0)
2720 switch (comparisonType)
2733 if (value.IsAscii() && IsAscii())
2737 return TextInfo.LastIndexOfStringOrdinalIgnoreCase(
this, value, startIndex, count);
2748 [__DynamicallyInvokable]
2751 return PadHelper(totalWidth,
' ', isRightPadded:
false);
2760 [__DynamicallyInvokable]
2761 public string PadLeft(
int totalWidth,
char paddingChar)
2763 return PadHelper(totalWidth, paddingChar, isRightPadded:
false);
2771 [__DynamicallyInvokable]
2774 return PadHelper(totalWidth,
' ', isRightPadded:
true);
2783 [__DynamicallyInvokable]
2784 public string PadRight(
int totalWidth,
char paddingChar)
2786 return PadHelper(totalWidth, paddingChar, isRightPadded:
true);
2790 [SecuritySafeCritical]
2791 private extern string PadHelper(
int totalWidth,
char paddingChar,
bool isRightPadded);
2799 [__DynamicallyInvokable]
2818 [SecuritySafeCritical]
2820 [__DynamicallyInvokable]
2827 if (comparisonType < StringComparison.CurrentCulture || comparisonType >
StringComparison.OrdinalIgnoreCase)
2831 if ((
object)
this == value)
2835 if (value.Length == 0)
2839 switch (comparisonType)
2850 if (
Length < value.Length)
2854 return nativeCompareOrdinalEx(
this, 0, value, 0, value.Length) == 0;
2856 if (
Length < value.Length)
2860 return TextInfo.CompareOrdinalIgnoreCaseEx(
this, 0, value, 0, value.Length, value.Length) == 0;
2881 if ((
object)
this == value)
2891 [__DynamicallyInvokable]
2904 if (culture ==
null)
2913 [__DynamicallyInvokable]
2921 [__DynamicallyInvokable]
2934 if (culture ==
null)
2943 [__DynamicallyInvokable]
2951 [__DynamicallyInvokable]
2972 private static bool IsBOMWhitespace(
char c)
2979 [__DynamicallyInvokable]
2982 return TrimHelper(2);
2985 [SecuritySafeCritical]
2986 private string TrimHelper(
int trimType)
2992 for (i = 0; i <
Length && (
char.IsWhiteSpace(
this[i]) || IsBOMWhitespace(
this[i])); i++)
2999 while (num >= i && (
char.IsWhiteSpace(
this[num]) || IsBOMWhitespace(
this[i])))
3004 return CreateTrimmedString(i, num);
3007 [SecuritySafeCritical]
3008 private string TrimHelper(
char[] trimChars,
int trimType)
3014 for (i = 0; i <
Length; i++)
3018 for (num2 = 0; num2 < trimChars.Length && trimChars[num2] != c; num2++)
3021 if (num2 == trimChars.Length)
3029 for (num =
Length - 1; num >= i; num--)
3032 char c2 =
this[num];
3033 for (num3 = 0; num3 < trimChars.Length && trimChars[num3] != c2; num3++)
3036 if (num3 == trimChars.Length)
3042 return CreateTrimmedString(i, num);
3046 private string CreateTrimmedString(
int start,
int end)
3048 int num = end - start + 1;
3057 return InternalSubString(start, num);
3069 [SecuritySafeCritical]
3070 [__DynamicallyInvokable]
3071 public unsafe
string Insert(
int startIndex,
string value)
3077 if (startIndex < 0 || startIndex >
Length)
3082 int length2 = value.Length;
3083 int num = length + length2;
3088 string text = FastAllocateString(num);
3089 fixed (
char* ptr2 = &m_firstChar)
3091 fixed (
char* smem = &value.m_firstChar)
3093 fixed (
char* ptr = &text.m_firstChar)
3095 wstrcpy(ptr, ptr2, startIndex);
3096 wstrcpy(ptr + startIndex, smem, length2);
3097 wstrcpy(ptr + startIndex + length2, ptr2 + startIndex, length - startIndex);
3105 [SecuritySafeCritical]
3106 private extern string ReplaceInternal(
char oldChar,
char newChar);
3112 [__DynamicallyInvokable]
3115 return ReplaceInternal(oldChar, newChar);
3119 [SecuritySafeCritical]
3120 private extern string ReplaceInternal(
string oldValue,
string newValue);
3130 [__DynamicallyInvokable]
3131 public string Replace(
string oldValue,
string newValue)
3133 if (oldValue ==
null)
3137 return ReplaceInternal(oldValue, newValue);
3147 [SecuritySafeCritical]
3148 [__DynamicallyInvokable]
3149 public unsafe
string Remove(
int startIndex,
int count)
3159 if (count >
Length - startIndex)
3163 int num =
Length - count;
3168 string text = FastAllocateString(num);
3169 fixed (
char* ptr2 = &m_firstChar)
3171 fixed (
char* ptr = &text.m_firstChar)
3173 wstrcpy(ptr, ptr2, startIndex);
3174 wstrcpy(ptr + startIndex, ptr2 + startIndex + count, num - startIndex);
3187 [__DynamicallyInvokable]
3194 if (startIndex >=
Length)
3208 [__DynamicallyInvokable]
3209 public static string Format(
string format,
object arg0)
3211 return FormatHelper(
null, format,
new ParamsArray(arg0));
3223 [__DynamicallyInvokable]
3224 public static string Format(
string format,
object arg0,
object arg1)
3226 return FormatHelper(
null, format,
new ParamsArray(arg0, arg1));
3239 [__DynamicallyInvokable]
3240 public static string Format(
string format,
object arg0,
object arg1,
object arg2)
3242 return FormatHelper(
null, format,
new ParamsArray(arg0, arg1, arg2));
3253 [__DynamicallyInvokable]
3254 public static string Format(
string format, params
object[] args)
3260 return FormatHelper(
null, format,
new ParamsArray(args));
3272 [__DynamicallyInvokable]
3275 return FormatHelper(provider, format,
new ParamsArray(arg0));
3288 [__DynamicallyInvokable]
3291 return FormatHelper(provider, format,
new ParamsArray(arg0, arg1));
3305 [__DynamicallyInvokable]
3308 return FormatHelper(provider, format,
new ParamsArray(arg0, arg1, arg2));
3320 [__DynamicallyInvokable]
3327 return FormatHelper(provider, format,
new ParamsArray(args));
3330 private static string FormatHelper(
IFormatProvider provider,
string format, ParamsArray args)
3336 return StringBuilderCache.GetStringAndRelease(StringBuilderCache.Acquire(format.Length + args.Length * 8).AppendFormatHelper(provider, format, args));
3344 [SecuritySafeCritical]
3345 public unsafe
static string Copy(
string str)
3351 int length = str.Length;
3352 string text = FastAllocateString(length);
3353 fixed (
char* dmem = &text.m_firstChar)
3355 fixed (
char* smem = &str.m_firstChar)
3357 wstrcpy(dmem, smem, length);
3366 [__DynamicallyInvokable]
3373 return arg0.ToString();
3380 [__DynamicallyInvokable]
3381 public static string Concat(
object arg0,
object arg1)
3391 return arg0.ToString() + arg1.ToString();
3399 [__DynamicallyInvokable]
3400 public static string Concat(
object arg0,
object arg1,
object arg2)
3414 return arg0.ToString() + arg1.ToString() + arg2.ToString();
3417 [CLSCompliant(
false)]
3418 public static string Concat(
object arg0,
object arg1,
object arg2,
object arg3, __arglist)
3422 object[] array =
new object[num];
3427 for (
int i = 4; i < num; i++)
3440 [__DynamicallyInvokable]
3441 public static string Concat(params
object[] args)
3447 string[] array =
new string[args.Length];
3449 for (
int i = 0; i < args.Length; i++)
3451 object obj = args[i];
3452 array[i] = ((obj ==
null) ?
Empty : obj.ToString());
3453 if (array[i] ==
null)
3457 num += array[i].Length;
3463 return ConcatArray(array, num);
3473 [__DynamicallyInvokable]
3483 while (enumerator.MoveNext())
3485 if (enumerator.
Current !=
null)
3487 string text = enumerator.
Current.ToString();
3490 stringBuilder.
Append(text);
3495 return StringBuilderCache.GetStringAndRelease(stringBuilder);
3504 [__DynamicallyInvokable]
3516 if (enumerator.
Current !=
null)
3522 return StringBuilderCache.GetStringAndRelease(stringBuilder);
3529 [SecuritySafeCritical]
3530 [__DynamicallyInvokable]
3531 public static string Concat(
string str0,
string str1)
3545 int length = str0.Length;
3546 string text = FastAllocateString(length + str1.Length);
3547 FillStringChecked(text, 0, str0);
3548 FillStringChecked(text, length, str1);
3557 [SecuritySafeCritical]
3558 [__DynamicallyInvokable]
3559 public static string Concat(
string str0,
string str1,
string str2)
3561 if (str0 ==
null && str1 ==
null && str2 ==
null)
3577 int length = str0.Length + str1.Length + str2.Length;
3578 string text = FastAllocateString(length);
3579 FillStringChecked(text, 0, str0);
3580 FillStringChecked(text, str0.Length, str1);
3581 FillStringChecked(text, str0.Length + str1.Length, str2);
3591 [SecuritySafeCritical]
3592 [__DynamicallyInvokable]
3593 public static string Concat(
string str0,
string str1,
string str2,
string str3)
3595 if (str0 ==
null && str1 ==
null && str2 ==
null && str3 ==
null)
3615 int length = str0.Length + str1.Length + str2.Length + str3.Length;
3616 string text = FastAllocateString(length);
3617 FillStringChecked(text, 0, str0);
3618 FillStringChecked(text, str0.Length, str1);
3619 FillStringChecked(text, str0.Length + str1.Length, str2);
3620 FillStringChecked(text, str0.Length + str1.Length + str2.Length, str3);
3624 [SecuritySafeCritical]
3625 private static string ConcatArray(
string[] values,
int totalLength)
3627 string text = FastAllocateString(totalLength);
3629 for (
int i = 0; i < values.Length; i++)
3631 FillStringChecked(text, num, values[i]);
3632 num += values[i].Length;
3643 [__DynamicallyInvokable]
3644 public static string Concat(params
string[] values)
3651 string[] array =
new string[values.Length];
3652 for (
int i = 0; i < values.Length; i++)
3654 string text = values[i];
3655 array[i] = ((text ==
null) ?
Empty : text);
3656 num += array[i].Length;
3662 return ConcatArray(array, num);
3670 [SecuritySafeCritical]
3685 [SecuritySafeCritical]
3707 [__DynamicallyInvokable]
3716 [__DynamicallyInvokable]
3717 char IConvertible.ToChar(IFormatProvider provider)
3719 return Convert.ToChar(
this, provider);
3727 [__DynamicallyInvokable]
3728 sbyte IConvertible.ToSByte(IFormatProvider provider)
3730 return Convert.ToSByte(
this, provider);
3738 [__DynamicallyInvokable]
3739 byte IConvertible.ToByte(IFormatProvider provider)
3741 return Convert.ToByte(
this, provider);
3749 [__DynamicallyInvokable]
3750 short IConvertible.ToInt16(IFormatProvider provider)
3752 return Convert.ToInt16(
this, provider);
3760 [__DynamicallyInvokable]
3761 ushort IConvertible.ToUInt16(IFormatProvider provider)
3763 return Convert.ToUInt16(
this, provider);
3769 [__DynamicallyInvokable]
3770 int IConvertible.ToInt32(IFormatProvider provider)
3772 return Convert.ToInt32(
this, provider);
3780 [__DynamicallyInvokable]
3781 uint IConvertible.ToUInt32(IFormatProvider provider)
3783 return Convert.ToUInt32(
this, provider);
3789 [__DynamicallyInvokable]
3790 long IConvertible.ToInt64(IFormatProvider provider)
3792 return Convert.ToInt64(
this, provider);
3798 [__DynamicallyInvokable]
3799 ulong IConvertible.ToUInt64(IFormatProvider provider)
3801 return Convert.ToUInt64(
this, provider);
3807 [__DynamicallyInvokable]
3808 float IConvertible.ToSingle(IFormatProvider provider)
3810 return Convert.ToSingle(
this, provider);
3818 [__DynamicallyInvokable]
3819 double IConvertible.ToDouble(IFormatProvider provider)
3821 return Convert.ToDouble(
this, provider);
3829 [__DynamicallyInvokable]
3830 decimal IConvertible.ToDecimal(IFormatProvider provider)
3832 return Convert.ToDecimal(
this, provider);
3838 [__DynamicallyInvokable]
3839 DateTime IConvertible.ToDateTime(IFormatProvider provider)
3841 return Convert.ToDateTime(
this, provider);
3851 [__DynamicallyInvokable]
3852 object IConvertible.ToType(Type type, IFormatProvider provider)
3854 return Convert.DefaultToType(
this, type, provider);
3859 internal extern bool IsFastSort();
3863 internal extern bool IsAscii();
3867 internal extern void SetTrailByte(
byte data);
3871 internal extern bool TryGetTrailByte(out
byte data);
3882 [__DynamicallyInvokable]
3890 [__DynamicallyInvokable]
3893 return new CharEnumerator(
this);
3897 internal unsafe
static void InternalCopy(
string src, IntPtr dest,
int len)
3901 fixed (
char* ptr = &src.m_firstChar)
3903 byte* src2 = (
byte*)ptr;
3904 byte* dest2 = (
byte*)(
void*)dest;
3905 Buffer.Memcpy(dest2, src2, len);
Represents a character encoding.To browse the .NET Framework source code for this type,...
Converts a base data type to another base data type.
static CultureInfo InvariantCulture
Gets the T:System.Globalization.CultureInfo object that is culture-independent (invariant).
int CompareTo(object value)
Compares this instance with a specified T:System.Object and indicates whether this instance precedes,...
int LastIndexOf(string value, StringComparison comparisonType)
Reports the zero-based index of the last occurrence of a specified string within the current T:System...
static string Format(string format, object arg0, object arg1)
Replaces the format items in a specified string with the string representation of two specified objec...
string [] Split(params char[] separator)
Splits a string into substrings that are based on the characters in an array.
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
The exception that is thrown when there is an attempt to dereference a null object reference.
int LastIndexOf(string value, int startIndex, int count)
Reports the zero-based index position of the last occurrence of a specified string within this instan...
unsafe string GetString(byte *bytes, int byteCount)
When overridden in a derived class, decodes a specified number of bytes starting at a specified addre...
bool EndsWith(string value, bool ignoreCase, CultureInfo culture)
Determines whether the end of this string instance matches the specified string when compared using t...
unsafe String(char *value)
Initializes a new instance of the T:System.String class to the value indicated by a specified pointer...
virtual char [] GetChars(byte[] bytes)
When overridden in a derived class, decodes all the bytes in the specified byte array into a set of c...
bool MoveNext()
Advances the enumerator to the next element of the collection.
Represents text as a sequence of UTF-16 code units.To browse the .NET Framework source code for this ...
int LastIndexOf(char value, int startIndex)
Reports the zero-based index position of the last occurrence of a specified Unicode character within ...
static string Concat(params object[] args)
Concatenates the string representations of the elements in a specified T:System.Object array.
int LastIndexOfAny(char[] anyOf)
Reports the zero-based index position of the last occurrence in this instance of one or more characte...
int LastIndexOf(string value)
Reports the zero-based index position of the last occurrence of a specified string within this instan...
virtual byte [] GetBytes(char[] chars)
When overridden in a derived class, encodes all the characters in the specified character array into ...
unsafe override string ToString()
Converts the value of this instance to a T:System.String.
virtual CompareInfo? CompareInfo
Gets the T:System.Globalization.CompareInfo that defines how to compare strings for the culture.
static string Format(string format, params object[] args)
Replaces the format item in a specified string with the string representation of a corresponding obje...
bool StartsWith(string value, bool ignoreCase, CultureInfo culture)
Determines whether the beginning of this string instance matches the specified string when compared u...
static bool Equals(string a, string b)
Determines whether two specified T:System.String objects have the same value.
int LastIndexOf(char value)
Reports the zero-based index position of the last occurrence of a specified Unicode character within ...
StringComparison
Specifies the culture, case, and sort rules to be used by certain overloads of the M:System....
bool ToBoolean(IFormatProvider provider)
Converts the value of this instance to an equivalent Boolean value using the specified culture-specif...
TypeCode
Specifies the type of an object.
string ToUpper()
Returns a copy of this string converted to uppercase.
int GetRemainingCount()
Returns the number of arguments remaining in the argument list.
static sbyte Min(sbyte val1, sbyte val2)
Returns the smaller of two 8-bit signed integers.
CharEnumerator GetEnumerator()
Retrieves an object that can iterate through the individual characters in this string.
int CompareTo(string strB)
Compares this instance with a specified T:System.String object and indicates whether this instance pr...
string [] Split(char[] separator, int count)
Splits a string into a maximum number of substrings based on the characters in an array....
The exception that is thrown when the value of an argument is outside the allowable range of values a...
string [] Split(char[] separator, int count, StringSplitOptions options)
Splits a string into a maximum number of substrings based on the characters in an array.
string [] Split(string[] separator, int count, StringSplitOptions options)
Splits a string into a maximum number of substrings based on the strings in an array....
int IndexOf(char value, int startIndex)
Reports the zero-based index of the first occurrence of the specified Unicode character in this strin...
string Substring(int startIndex)
Retrieves a substring from this instance. The substring starts at a specified character position and ...
string Substring(int startIndex, int length)
Retrieves a substring from this instance. The substring starts at a specified character position and ...
bool StartsWith(string value, StringComparison comparisonType)
Determines whether the beginning of this string instance matches the specified string when compared u...
unsafe TypedReference GetNextArg()
Returns the next argument in a variable-length argument list.
string TrimStart(params char[] trimChars)
Removes all leading occurrences of a set of characters specified in an array from the current T:Syste...
static bool IsNullOrWhiteSpace(string value)
Indicates whether a specified string is null, empty, or consists only of white-space characters.
virtual int GetCharCount(byte[] bytes)
When overridden in a derived class, calculates the number of characters produced by decoding all the ...
static int Compare(string strA, int indexA, string strB, int indexB, int length, bool ignoreCase)
Compares substrings of two specified T:System.String objects, ignoring or honoring their case,...
bool EndsWith(string value, StringComparison comparisonType)
Determines whether the end of this string instance matches the specified string when compared using t...
string Remove(int startIndex)
Returns a new string in which all the characters in the current instance, beginning at a specified po...
static int Compare(string strA, int indexA, string strB, int indexB, int length)
Compares substrings of two specified T:System.String objects and returns an integer that indicates th...
string ToLower()
Returns a copy of this string converted to lowercase.
static string Intern(string str)
Retrieves the system's reference to the specified T:System.String.
int LastIndexOf(string value, int startIndex, StringComparison comparisonType)
Reports the zero-based index of the last occurrence of a specified string within the current T:System...
static unsafe string Copy(string str)
Creates a new instance of T:System.String with the same value as a specified T:System....
TypeCode GetTypeCode()
Returns the T:System.TypeCode for class T:System.String.
virtual int LastIndexOf(string source, char value)
Searches for the specified character and returns the zero-based index of the last occurrence within t...
int LastIndexOfAny(char[] anyOf, int startIndex)
Reports the zero-based index position of the last occurrence in this instance of one or more characte...
static string Concat(IEnumerable< string > values)
Concatenates the members of a constructed T:System.Collections.Generic.IEnumerable`1 collection of ty...
virtual TextInfo TextInfo
Gets the T:System.Globalization.TextInfo that defines the writing system associated with the culture.
virtual bool IsSuffix(string source, string suffix, CompareOptions options)
Determines whether the specified source string ends with the specified suffix using the specified T:S...
Defines a generalized type-specific comparison method that a value type or class implements to order ...
Supports iterating over a T:System.String object and reading its individual characters....
A type representing a date and time value.
static int CompareOrdinal(string strA, int indexA, string strB, int indexB, int length)
Compares substrings of two specified T:System.String objects by evaluating the numeric values of the ...
Cer
Specifies a method's behavior when called within a constrained execution region.
static string Format(string format, object arg0, object arg1, object arg2)
Replaces the format items in a specified string with the string representation of three specified obj...
int IndexOf(char value)
Reports the zero-based index of the first occurrence of the specified Unicode character in this strin...
Represents a variable-length argument list; that is, the parameters of a function that takes a variab...
static unsafe object ToObject(TypedReference value)
Converts the specified TypedReference to an Object.
static string Join(string separator, params object[] values)
Concatenates the elements of an object array, using the specified separator between each element.
string ToLowerInvariant()
Returns a copy of this T:System.String object converted to lowercase using the casing rules of the in...
string [] Split(char[] separator, StringSplitOptions options)
Splits a string into substrings based on the characters in an array. You can specify whether the subs...
static string Format(IFormatProvider provider, string format, object arg0, object arg1, object arg2)
Replaces the format items in a specified string with the string representation of three specified obj...
Exposes an enumerator, which supports a simple iteration over a non-generic collection....
Provides information about, and means to manipulate, the current environment and platform....
static bool ToBoolean(object value)
Converts the value of a specified object to an equivalent Boolean value.
Describes objects that contain both a managed pointer to a location and a runtime representation of t...
StringBuilder Append(char value, int repeatCount)
Appends a specified number of copies of the string representation of a Unicode character to this inst...
static int Compare(string strA, int indexA, string strB, int indexB, int length, bool ignoreCase, CultureInfo culture)
Compares substrings of two specified T:System.String objects, ignoring or honoring their case and usi...
static string Format(IFormatProvider provider, string format, object arg0, object arg1)
Replaces the format items in a specified string with the string representation of two specified objec...
A cast or conversion operation, such as (SampleType)obj in C::or CType(obj, SampleType) in Visual Bas...
The exception that is thrown when an attempt is made to access an element of an array or collection w...
static readonly string Empty
Represents the empty string. This field is read-only.
static unsafe string Join(string separator, string[] value, int startIndex, int count)
Concatenates the specified elements of a string array, using the specified separator between each ele...
NormalizationForm
Defines the type of normalization to perform.
string ToString(IFormatProvider provider)
Returns this instance of T:System.String; no actual conversion is performed.
static bool operator !=(string a, string b)
Determines whether two specified strings have different values.
StringSplitOptions
Specifies whether applicable Overload:System.String.Split method overloads include or omit empty subs...
static string Join(string separator, params string[] value)
Concatenates all the elements of a string array, using the specified separator between each element.
virtual int Compare(string string1, string string2)
Compares two strings.
bool Equals(string value)
Determines whether this instance and another specified T:System.String object have the same value.
string Trim(params char[] trimChars)
Removes all leading and trailing occurrences of a set of characters specified in an array from the cu...
object Clone()
Returns a reference to this instance of T:System.String.
bool IsNormalized(NormalizationForm normalizationForm)
Indicates whether this string is in the specified Unicode normalization form.
static string Concat(object arg0, object arg1)
Concatenates the string representations of two specified objects.
static string Format(string format, object arg0)
Replaces one or more format items in a specified string with the string representation of a specified...
unsafe char [] ToCharArray()
Copies the characters in this instance to a Unicode character array.
string ToUpperInvariant()
Returns a copy of this T:System.String object converted to uppercase using the casing rules of the in...
static string Concat(object arg0)
Creates the string representation of a specified object.
string PadRight(int totalWidth, char paddingChar)
Returns a new string that left-aligns the characters in this string by padding them on the right with...
object Current
Gets the element in the collection at the current position of the enumerator.
unsafe override int GetHashCode()
Returns the hash code for this string.
string Replace(string oldValue, string newValue)
Returns a new string in which all occurrences of a specified string in the current instance are repla...
int IndexOf(string value, int startIndex)
Reports the zero-based index of the first occurrence of the specified string in this instance....
static string Format(IFormatProvider provider, string format, object arg0)
Replaces the format item or items in a specified string with the string representation of the corresp...
virtual char ToLower(char c)
Converts the specified character to lowercase.
string TrimEnd(params char[] trimChars)
Removes all trailing occurrences of a set of characters specified in an array from the current T:Syst...
Supports cloning, which creates a new instance of a class with the same value as an existing instance...
static int Compare(string strA, int indexA, string strB, int indexB, int length, StringComparison comparisonType)
Compares substrings of two specified T:System.String objects using the specified rules,...
static string Concat(params string[] values)
Concatenates the elements of a specified T:System.String array.
static string Concat(object arg0, object arg1, object arg2)
Concatenates the string representations of three specified objects.
string PadRight(int totalWidth)
Returns a new string that left-aligns the characters in this string by padding them with spaces on th...
int IndexOf(string value)
Reports the zero-based index of the first occurrence of the specified string in this instance.
The exception that is thrown when there is not enough memory to continue the execution of a program.
static string Concat(string str0, string str1)
Concatenates two specified instances of T:System.String.
static bool Equals(string a, string b, StringComparison comparisonType)
Determines whether two specified T:System.String objects have the same value. A parameter specifies t...
new T Current
Gets the element in the collection at the current position of the enumerator.
static int Compare(string strA, string strB, bool ignoreCase)
Compares two specified T:System.String objects, ignoring or honoring their case, and returns an integ...
string Replace(char oldChar, char newChar)
Returns a new string in which all occurrences of a specified Unicode character in this instance are r...
int IndexOfAny(char[] anyOf)
Reports the zero-based index of the first occurrence in this instance of any character in a specified...
MethodImplOptions
Defines the details of how a method is implemented.
static AppDomain GetDomain()
Returns the current domain in which the current thread is running.
CharSet
Dictates which character set marshaled strings should use.
unsafe char [] ToCharArray(int startIndex, int length)
Copies the characters in a specified substring in this instance to a Unicode character array.
bool Contains(string value)
Returns a value indicating whether a specified substring occurs within this string.
IEnumerator GetEnumerator()
Returns an enumerator that iterates through a collection.
bool StartsWith(string value)
Determines whether the beginning of this string instance matches the specified string.
string ToUpper(CultureInfo culture)
Returns a copy of this string converted to uppercase, using the casing rules of the specified culture...
Represents a mutable string of characters. This class cannot be inherited.To browse the ....
int IndexOf(string value, int startIndex, StringComparison comparisonType)
Reports the zero-based index of the first occurrence of the specified string in the current T:System....
static string IsInterned(string str)
Retrieves a reference to a specified T:System.String.
static CultureInfo CurrentCulture
Gets or sets the T:System.Globalization.CultureInfo object that represents the culture used by the cu...
string PadLeft(int totalWidth)
Returns a new string that right-aligns the characters in this instance by padding them with spaces on...
The exception that is thrown when one of the arguments provided to a method is not valid.
bool IsNormalized()
Indicates whether this string is in Unicode normalization form C.
unsafe string Remove(int startIndex, int count)
Returns a new string in which a specified number of characters in the current instance beginning at a...
static string Format(IFormatProvider provider, string format, params object[] args)
Replaces the format items in a specified string with the string representations of corresponding obje...
virtual int IndexOf(string source, char value)
Searches for the specified character and returns the zero-based index of the first occurrence within ...
static bool IsNullOrEmpty(string value)
Indicates whether the specified string is null or an F:System.String.Empty string.
override string ToString()
Returns this instance of T:System.String; no actual conversion is performed.
static int Compare(string strA, string strB)
Compares two specified T:System.String objects and returns an integer that indicates their relative p...
int IndexOfAny(char[] anyOf, int startIndex)
Reports the zero-based index of the first occurrence in this instance of any character in a specified...
virtual bool IsPrefix(string source, string prefix, CompareOptions options)
Determines whether the specified source string starts with the specified prefix using the specified T...
bool EndsWith(string value)
Determines whether the end of this string instance matches the specified string.
static string Join(string separator, IEnumerable< string > values)
Concatenates the members of a constructed T:System.Collections.Generic.IEnumerable`1 collection of ty...
Defines a generalized method that a value type or class implements to create a type-specific method f...
Specifies that the class can be serialized.
int IndexOf(string value, int startIndex, int count, StringComparison comparisonType)
Reports the zero-based index of the first occurrence of the specified string in the current T:System....
static bool operator==(string a, string b)
Determines whether two specified strings have the same value.
string Normalize()
Returns a new string whose textual value is the same as this string, but whose binary representation ...
bool Equals(string value, StringComparison comparisonType)
Determines whether this string and a specified T:System.String object have the same value....
Consistency
Specifies a reliability contract.
Defines text properties and behaviors, such as casing, that are specific to a writing system.
static int CompareOrdinal(string strA, string strB)
Compares two specified T:System.String objects by evaluating the numeric values of the corresponding ...
static string Join< T >(string separator, IEnumerable< T > values)
Concatenates the members of a collection, using the specified separator between each member.
Provides information about a specific culture (called a locale for unmanaged code development)....
Provides constants and static methods for trigonometric, logarithmic, and other common mathematical f...
The exception that is thrown when an invoked method is not supported, or when there is an attempt to ...
CompareOptions
Defines the string comparison options to use with T:System.Globalization.CompareInfo.
static string Concat< T >(IEnumerable< T > values)
Concatenates the members of an T:System.Collections.Generic.IEnumerable`1 implementation.
virtual char ToUpper(char c)
Converts the specified character to uppercase.
Defines methods that convert the value of the implementing reference or value type to a common langua...
int IndexOf(string value, StringComparison comparisonType)
Reports the zero-based index of the first occurrence of the specified string in the current T:System....
int Length
Gets the number of characters in the current T:System.String object.
static string Concat(string str0, string str1, string str2)
Concatenates three specified instances of T:System.String.
override bool Equals(object obj)
Determines whether this instance and a specified object, which must also be a T:System....
static int Compare(string strA, int indexA, string strB, int indexB, int length, CultureInfo culture, CompareOptions options)
Compares substrings of two specified T:System.String objects using the specified comparison options a...
static int Compare(string strA, string strB, CultureInfo culture, CompareOptions options)
Compares two specified T:System.String objects using the specified comparison options and culture-spe...
string [] Split(string[] separator, StringSplitOptions options)
Splits a string into substrings based on the strings in an array. You can specify whether the substri...
static string Concat(string str0, string str1, string str2, string str3)
Concatenates four specified instances of T:System.String.
unsafe void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count)
Copies a specified number of characters from a specified position in this instance to a specified pos...
static int Compare(string strA, string strB, bool ignoreCase, CultureInfo culture)
Compares two specified T:System.String objects, ignoring or honoring their case, and using culture-sp...
int LastIndexOf(string value, int startIndex, int count, StringComparison comparisonType)
Reports the zero-based index position of the last occurrence of a specified string within this instan...
string Normalize(NormalizationForm normalizationForm)
Returns a new string whose textual value is the same as this string, but whose binary representation ...
int LastIndexOf(string value, int startIndex)
Reports the zero-based index position of the last occurrence of a specified string within this instan...
unsafe string Insert(int startIndex, string value)
Returns a new string in which a specified string is inserted at a specified index position in this in...
int IndexOf(string value, int startIndex, int count)
Reports the zero-based index of the first occurrence of the specified string in this instance....
string PadLeft(int totalWidth, char paddingChar)
Returns a new string that right-aligns the characters in this instance by padding them on the left wi...
string Trim()
Removes all leading and trailing white-space characters from the current T:System....
static int Compare(string strA, string strB, StringComparison comparisonType)
Compares two specified T:System.String objects using the specified rules, and returns an integer that...
string ToLower(CultureInfo culture)
Returns a copy of this string converted to lowercase, using the casing rules of the specified culture...
Creates and controls a thread, sets its priority, and gets its status.