From 44de72c0e7de08fa9566ca8e5ad0af3a36db0ba0 Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Wed, 13 Sep 2017 19:38:31 -0400 Subject: [PATCH 1/4] fix constructor remarks formatting. --- xml/System/String.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/xml/System/String.xml b/xml/System/String.xml index c8a8295c19d83..09c22c04c8571 100644 --- a/xml/System/String.xml +++ b/xml/System/String.xml @@ -567,36 +567,36 @@ For additional guidance on choosing an overload, see [Which method do I call?](#Tasks) - `String(Char[]` `value` `)` + `String(Char[] value)` Initializes the new instance to the value indicated by an array of Unicode characters. This constructor copies Unicode characters([example](#Ctor2_Example)). - `String(Char[]` `value` `, Int32` `startIndex` `, Int32` `length` `)` + `String(Char[] value, Int32 startIndex, Int32 length)` Initializes the new instance to the value indicated by an array of Unicode characters, a starting character position within that array, and a length ([example](#Ctor3_Example)). - `String(Char` `c` `, Int32` `count` `)` + `String(Char c, Int32 count)` Initializes the new instance to the value indicated by a specified Unicode character repeated a specified number of times ([example](#Ctor3_Example)). - `String(char*` `value` `)` + `String(char* value)` **(Not CLS-compliant)** Initializes the new instance to the value indicated by a pointer to an array of Unicode characters that is terminated by a null character (U+0000 or '\0'). ([example](#Ctor4_Example)). Permission: , requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code. - `String(char*` `value` `, Int32` `startIndex` `, Int32` `length` `)` + `String(char* value, Int32 startIndex, Int32 length)` **(Not CLS-compliant)** Initializes the new instance to the value indicated by a pointer to an array of Unicode characters, a starting character position within that array, and a length. The constructor copies the Unicode characters from `value` starting at index `startIndex` and ending at index `startIndex` + `length` – 1 ([example](#Ctor5_Example)). Permission: , requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code. - `String(SByte*` `value` `)` + `String(SByte* value)` **(Not CLS-compliant)** Initializes the new instance to the value indicated by a pointer to an array of 8-bit signed integers. The array is assumed to represent a string encoded using the current system code page (that is, the encoding specified by ). The constructor processes characters from `value` starting from the location specified by the pointer until a null character (0x00) is reached ([example](#Ctor6_Example)). Permission: , requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code. - `String(SByte*` `value` `, Int32` `startIndex` `, Int32` `length` `)` + `String(SByte* value, Int32 startIndex, Int32 length)` **(Not CLS-compliant)** Initializes the new instance to the value indicated by a pointer to an array of 8-bit signed integers, a starting position within that array, and a length. The array is assumed to represent a string encoded using the current system code page (that is, the encoding specified by ). The constructor processes characters from value starting at `startIndex` and ending at `startIndex` + `length` – 1 ([example](#Ctor6_Example)). Permission: , requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code. - `String(SByte*` `value` `, Int32` `startIndex` `, Int32` `length` `, Encoding` `enc` `)` + `String(SByte* value, Int32 startIndex, Int32 length, Encoding enc)` **(Not CLS-compliant)** Initializes the new instance to the value indicated by a pointer to an array of 8-bit signed integers, a starting position within that array, a length, and an object. Permission: , requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code. From b126c9d6feec95a24681b283caf4de85b75700ed Mon Sep 17 00:00:00 2001 From: Maira Wenzel Date: Fri, 15 Sep 2017 16:10:43 -0700 Subject: [PATCH 2/4] another instance --- xml/System/String.xml | 1585 +---------------------------------------- 1 file changed, 7 insertions(+), 1578 deletions(-) diff --git a/xml/System/String.xml b/xml/System/String.xml index 09c22c04c8571..8671b3b5c3c55 100644 --- a/xml/System/String.xml +++ b/xml/System/String.xml @@ -1,4 +1,4 @@ - +fo @@ -4324,19 +4324,19 @@ ## Overloaded method syntax For additional guidance on choosing an overload, see [Which method do I call?](#FTaskList) - `String String.Format(String` `format` `, Object` `arg0` `)` + `String String.Format(String format, Object arg0)` Replaces the format items with the string representation of a specified object ([example](#Format1_Example)). - `String String.Format(String` `format` `, Object` `arg0` `, Object` `arg1` `)` + `String String.Format(String format, Object arg0, Object arg1)` Replaces the format items with the string representation of two specified objects ([example](#Format2_Example)). - `String String.Format(String` `format` `, Object` `arg0` `, Object` `arg1` `, Object` `arg2` `)` + `String String.Format(String format, Object arg0, Object arg1, Object arg2)` Replaces the format items with the string representation of three specified objects ([example](#Format3_Example)). - `String String.Format(String` `format` `, params Object[]` `args` `)` + `String String.Format(String format, params Object[] args)` Replaces the format items with the string representations of corresponding objects in a specified array ([example](#Format4_Example)). - `String String.Format(IFormatProvider` `provider` `, String` `format` `, params Object[]` `args` `)` + `String String.Format(IFormatProvider provider, String format, params Object[] args)` Replaces the format items with the string representation of corresponding objects in a specified array, and uses the specified culture-specific formatting information ([example](#Format5_Example)) or custom formatting information ([example](#Format6_Example)). @@ -10094,1575 +10094,4 @@ String 'This is a string.' in domain 'NewDomain': 75CC8236 Method System.Runtime - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.Boolean - - - - - - This parameter is ignored. - For a description of this member, see . - - if the value of the current string is ; if the value of the current string is . - - instance is cast to an interface. The recommended alternative is to call the method. - - ]]> - - The value of the current string is not or . - - - - - - - Method - - System.Runtime - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.Byte - - - - - - An object that provides culture-specific formatting information. - For a description of this member, see . - The converted value of the current object. - - instance is cast to an interface. The recommended alternative is to call the method. - - ]]> - - The value of the current object cannot be parsed. - The value of the current object is a number greater than or less than . - - - - - - - Method - - System.Runtime - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.Char - - - - - - An object that provides culture-specific formatting information. - For a description of this member, see . - The character at index 0 in the current object. - - instance is cast to an interface. The recommended alternative is to call the method. - - ]]> - - - - - - - - Method - - System.Runtime - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.DateTime - - - - - - An object that provides culture-specific formatting information. - For a description of this member, see . - The converted value of the current object. - - instance is cast to an interface. The recommended alternative is to call the method. - - ]]> - - - - - - - - Method - - System.Runtime - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.Decimal - - - - - - An object that provides culture-specific formatting information. - For a description of this member, see . - The converted value of the current object. - - instance is cast to an interface. The recommended alternative is to call the method. - - ]]> - - The value of the current object cannot be parsed. - The value of the current object is a number less than or than greater. - - - - - - - Method - - System.Runtime - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.Double - - - - - - An object that provides culture-specific formatting information. - For a description of this member, see . - The converted value of the current object. - - instance is cast to an interface. The recommended alternative is to call the method. - - ]]> - - The value of the current object cannot be parsed. - The value of the current object is a number less than or greater than . - - - - - - - Method - - System.Runtime - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.Int16 - - - - - - An object that provides culture-specific formatting information. - For a description of this member, see . - The converted value of the current object. - - instance is cast to an interface. The recommended alternative is to call the method. - - ]]> - - The value of the current object cannot be parsed. - The value of the current object is a number greater than or less than . - - - - - - - Method - - System.Runtime - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.Int32 - - - - - - An object that provides culture-specific formatting information. - For a description of this member, see . - The converted value of the current object. - - instance is cast to an interface. The recommended alternative is to call the method. - - ]]> - - - - - - - - Method - - System.Runtime - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.Int64 - - - - - - An object that provides culture-specific formatting information. - For a description of this member, see . - The converted value of the current object. - - instance is cast to an interface. The recommended alternative is to call the method. - - ]]> - - - - - - - - Method - - System.Runtime - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.SByte - - - - - - An object that provides culture-specific formatting information. - For a description of this member, see . - The converted value of the current object. - - instance is cast to an interface. The recommended alternative is to call the method. - - ]]> - - The value of the current object cannot be parsed. - The value of the current object is a number greater than or less than . - - - - - - - Method - - System.Runtime - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.Single - - - - - - An object that provides culture-specific formatting information. - For a description of this member, see . - The converted value of the current object. - - instance is cast to an interface. The recommended alternative is to call the method. - - ]]> - - - - - - - - Method - - System.Runtime - 4.0.20.0 - 4.1.0.0 - - - System.String - - - - - - To be added. - To be added. - To be added. - To be added. - - - - - - - Method - - System.Runtime - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.Object - - - - - - - The type of the returned object. - An object that provides culture-specific formatting information. - For a description of this member, see . - The converted value of the current object. - - instance is cast to an interface. The recommended alternative is to call the method. - - ]]> - - - is . - The value of the current object cannot be converted to the type specified by the parameter. - - - - - - - Method - - System.Runtime - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.UInt16 - - - - - - An object that provides culture-specific formatting information. - For a description of this member, see . - The converted value of the current object. - - instance is cast to an interface. The recommended alternative is to call the method. - - ]]> - - The value of the current object cannot be parsed. - The value of the current object is a number greater than or less than . - - - - - - - Method - - System.Runtime - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.UInt32 - - - - - - An object that provides culture-specific formatting information. - For a description of this member, see . - The converted value of the current object. - - instance is cast to an interface. The recommended alternative is to call the method. - - ]]> - - The value of the current object cannot be parsed. - The value of the current object is a number greater or less than - - - - - - - Method - - System.Runtime - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.UInt64 - - - - - - An object that provides culture-specific formatting information. - For a description of this member, see . - The converted value of the current object. - - instance is cast to an interface. The recommended alternative is to call the method. - - ]]> - - - - - - - - Method - - System.Runtime - 4.0.0.0 - 4.0.10.0 - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - - System.Security.SecuritySafeCritical - - - - System.Char[] - - - - Copies the characters in this instance to a Unicode character array. - A Unicode character array whose elements are the individual characters of this instance. If this instance is an empty string, the returned array is empty and has a zero length. - - object) in a string to a character array. The first character copied is at index zero of the returned character array; the last character copied is at index – 1. - - To create a string from the characters in a character array, call the constructor. - - To create a byte array that contains the encoded characters in a string, instantiate the appropriate object and call its method. Some of the standard encodings available in the .NET Framework include the following: - -|Encoding|Object| -|--------------|------------| -|ASCII|| -|UTF-7|| -|UTF-8|| -|UTF-16|| -|UTF-32|| - - For more information, see [Character Encoding in the .NET Framework](~/docs/standard/base-types/character-encoding.md). - - - -## Examples - The following example calls the method to extract the characters in a string to a character array. It then displays the original string and the elements in the array. - - [!code-csharp[System.String.ToCharArray#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.string.tochararray/cs/ToCharArray1.cs#1)] - [!code-vb[System.String.ToCharArray#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.string.tochararray/vb/ToCharArray1.vb#1)] - - The following example defines a string containing the characters that serve as delimiters in a delimited string. It then calls the method to create a character array that can be passed to the method to separate the delimited string into its individual substrings. - - [!code-cpp[StringSplit2#1](~/samples/snippets/cpp/VS_Snippets_CLR/StringSplit2/CPP/stringsplit2.cpp#1)] - [!code-csharp[StringSplit2#1](~/samples/snippets/csharp/VS_Snippets_CLR/StringSplit2/CS/stringsplit2.cs#1)] - [!code-vb[StringSplit2#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/StringSplit2/VB/stringsplit2.vb#1)] - - ]]> - - - - - - - - Method - - System.Runtime - 4.0.0.0 - 4.0.10.0 - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - - System.Security.SecuritySafeCritical - - - - System.Char[] - - - - - - - The starting position of a substring in this instance. - The length of the substring in this instance. - Copies the characters in a specified substring in this instance to a Unicode character array. - A Unicode character array whose elements are the number of characters in this instance starting from character position . - - constructor. - - The `startIndex` parameter is zero-based. That is, the index of the first character in the string instance is zero. - - If `length` is zero, the returned array is empty and has a zero length. If this instance is `null` or an empty string (""), the returned array is empty and has a zero length. - - To create a byte array that contains the encoded characters in a portion of a string, instantiate the appropriate object and call its method. Some of the standard encodings available in the .NET Framework include the following: - -|Encoding|Object| -|--------------|------------| -|ASCII|| -|UTF-7|| -|UTF-8|| -|UTF-16|| -|UTF-32|| - - For more information, see [Character Encoding in the .NET Framework](~/docs/standard/base-types/character-encoding.md). - - - -## Examples - The following example converts a substring within a string to an array of characters, then enumerates and displays the elements of the array. - - [!code-cpp[string.tochararray1#1](~/samples/snippets/cpp/VS_Snippets_CLR/string.ToCharArray1/CPP/tocharry1.cpp#1)] - [!code-csharp[string.tochararray1#1](~/samples/snippets/csharp/VS_Snippets_CLR/string.ToCharArray1/CS/tocharry1.cs#1)] - [!code-vb[string.tochararray1#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/string.ToCharArray1/VB/tocharry1.vb#1)] - - ]]> - - - or is less than zero. - - -or- - - plus is greater than the length of this instance. - - - - - - - Method - - System.Runtime - 4.0.0.0 - 4.0.10.0 - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.String - - - - Returns a copy of this string converted to lowercase. - A string in lowercase. - - [!NOTE] -> This method does not modify the value of the current instance. Instead, it returns a new string in which all characters in the current instance are converted to lowercase. - -## Security Considerations - The casing operation that results from calling the method takes the casing conventions of the current culture into account. If you need the lowercase or uppercase version of an operating system identifier, such as a file name, named pipe, or registry key, use the or methods. This produces the same result in every culture (unlike the method) and performs more efficiently. - - - -## Examples - The following example converts several mixed case strings to lowercase. - - [!code-cpp[stringlowerupper#1](~/samples/snippets/cpp/VS_Snippets_CLR/stringlowerupper/CPP/stringtolower.cpp#1)] - [!code-csharp[stringlowerupper#1](~/samples/snippets/csharp/VS_Snippets_CLR/stringlowerupper/CS/stringtolower.cs#1)] - [!code-vb[stringlowerupper#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/stringlowerupper/VB/stringtolower.vb#1)] - - ]]> - - - As explained in [Best Practices for Using Strings](~/docs/standard/base-types/best-practices-strings.md), we recommend that you avoid calling string casing methods that substitute default values and instead call methods that require parameters to be explicitly specified. To convert a character to lowercase by using the casing conventions of the current culture, call the method overload with a value of for its parameter. - - - - - - - - Method - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.Runtime - 4.2.0.0 - - - System.String - - - - - - An object that supplies culture-specific casing rules. - Returns a copy of this string converted to lowercase, using the casing rules of the specified culture. - The lowercase equivalent of the current string. - - [!NOTE] -> This method does not modify the value of the current instance. Instead, it returns a new string in which all characters in the current instance are converted to lowercase. - -## Security Considerations - If you pass the method a object other than , the casing operation will take culture-specific rules into account. If you need the lowercase or uppercase version of an operating system identifier, such as a file name, named pipe, or registry key, use the or method. This produces the same result in every culture and performs more efficiently. - - - -## Examples - The following example converts two strings of uppercase characters to lowercase characters using the English-United States and Turkish-Turkey cultures, then compares the lowercase strings. The uppercase strings are identical except that for each occurrence of the Unicode LATIN CAPITAL LETTER I in one string, the other string contains LATIN CAPITAL LETTER I WITH DOT ABOVE. - - [!code-cpp[string.tolower1#1](~/samples/snippets/cpp/VS_Snippets_CLR/string.tolower1/CPP/tolower.cpp#1)] - [!code-csharp[string.tolower1#1](~/samples/snippets/csharp/VS_Snippets_CLR/string.tolower1/CS/tolower.cs#1)] - [!code-vb[string.tolower1#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/string.tolower1/VB/tolower.vb#1)] - - ]]> - - - is . - - - - - - - Method - - System.Runtime - 4.0.0.0 - 4.0.10.0 - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.String - - - - Returns a copy of this object converted to lowercase using the casing rules of the invariant culture. - The lowercase equivalent of the current string. - - property. - - If your application depends on the case of a string changing in a predictable way that is unaffected by the current culture, use the method. The method is equivalent to `ToLower(CultureInfo.InvariantCulture)`. The method is recommended when a collection of strings must appear in a predictable order in a user interface control. - -> [!NOTE] -> This method does not modify the value of the current instance. Instead, it returns a new string in which all characters in the current instance are converted to lowercase. - -## Security Considerations - If you need the lowercase or uppercase version of an operating system identifier, such as a file name, named pipe, or registry key, use the or methods. - - - -## Examples - The following example defines a string array that contains a single word in a number of languages. The method is used to populate the elements of a parallel array with the case-insensitive version of each word. The method is used to sort the case-sensitive array based on the order of elements in the lowercase array to ensure that elements appear in the same order regardless of language. - - [!code-csharp[System.String.ToLowerInvariant#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.string.tolowerinvariant/cs/tolowerinvariant.cs#1)] - [!code-vb[System.String.ToLowerInvariant#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.string.tolowerinvariant/vb/tolowerinvariant.vb#1)] - - ]]> - - - - - - - - Method - - System.Runtime - 4.0.0.0 - 4.0.10.0 - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.String - - - - Returns this instance of ; no actual conversion is performed. - The current string. - - method.Note that the example does not explicitly call the method. Instead, the method is called implicitly by the [composite formatting](~/docs/standard/base-types/composite-formatting.md) feature. - - [!code-cpp[string.tostring#1](~/samples/snippets/cpp/VS_Snippets_CLR/string.tostring/CPP/string.tostring.cpp#1)] - [!code-csharp[string.tostring#1](~/samples/snippets/csharp/VS_Snippets_CLR/string.tostring/CS/string.tostring.cs#1)] - [!code-vb[string.tostring#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/string.tostring/VB/string.tostring.vb#1)] - - ]]> - - - - - - - - Method - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.Runtime - 4.2.0.0 - - - System.String - - - - - - (Reserved) An object that supplies culture-specific formatting information. - Returns this instance of ; no actual conversion is performed. - The current string. - - - - - - - - - - Method - - System.Runtime - 4.0.0.0 - 4.0.10.0 - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.String - - - - Returns a copy of this string converted to uppercase. - The uppercase equivalent of the current string. - - [!NOTE] -> This method does not modify the value of the current instance. Instead, it returns a new string in which all characters in the current instance are converted to uppercase. - - The method is often used to convert a string to uppercase so that it can be used in a case-insensitive comparison. A better method to perform case-insensitive comparison is to call a string comparison method that has a parameter whose value you set to for a culture-sensitive, case-insensitive comparison. - -## Security Considerations - The casing operation that results from calling the method takes the casing conventions of the current culture into account. If you need the lowercase or uppercase version of an operating system identifier, such as a file name, named pipe, or registry key, use the or method. This produces the same result in every culture (unlike the method) and performs more efficiently. - - - -## Examples - The following example calls the method to convert a series of one-character strings that contain each character in the Basic Latin, Latin-1 Supplement, and Latin Extended-A character sets. It then displays each string whose uppercase character is different from its lowercase character. - - [!code-cpp[System.String.ToUpper#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.String.ToUpper/cpp/ToUpperEx.cpp#1)] - [!code-csharp[System.String.ToUpper#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.ToUpper/cs/ToUpperEx.cs#1)] - [!code-vb[System.String.ToUpper#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.ToUpper/vb/ToUpperEx.vb#1)] - - ]]> - - - As explained in [Best Practices for Using Strings](~/docs/standard/base-types/best-practices-strings.md), we recommend that you avoid calling string casing methods that substitute default values and instead call methods that require parameters to be explicitly specified. To convert a string to uppercase by using the casing conventions of the current culture, call the method overload with a value of for its parameter. - - - - - - - - Method - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.Runtime - 4.2.0.0 - - - System.String - - - - - - An object that supplies culture-specific casing rules. - Returns a copy of this string converted to uppercase, using the casing rules of the specified culture. - The uppercase equivalent of the current string. - - [!NOTE] -> This method does not modify the value of the current instance. Instead, it returns a new string in which all characters in the current instance are converted to uppercase. - -## Security Considerations - If you pass the method a object other than , the casing operation will take culture-specific rules into account. If you need the lowercase or uppercase version of an operating system identifier, such as a file name, named pipe, or registry key, use the or method. This produces the same result in every culture and performs more efficiently. - - - -## Examples - The following example converts a string of lowercase characters to two strings of uppercase characters using the English-United States and Turkish-Turkey cultures, then compares the uppercase strings. The uppercase strings are identical except that for each occurrence of the Unicode LATIN CAPITAL LETTER I in one string, the other string contains LATIN CAPITAL LETTER I WITH DOT ABOVE. - - [!code-csharp[string.toupper1#1](~/samples/snippets/csharp/VS_Snippets_CLR/string.toupper1/CS/toupper.cs#1)] - [!code-vb[string.toupper1#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/string.toupper1/VB/toupper.vb#1)] - - ]]> - - - is . - - - - - - - Method - - System.Runtime - 4.0.0.0 - 4.0.10.0 - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.String - - - - Returns a copy of this object converted to uppercase using the casing rules of the invariant culture. - The uppercase equivalent of the current string. - - property. - - If your application depends on the case of a string changing in a predictable way that is unaffected by the current culture, use the method. The method is equivalent to `ToUpper(CultureInfo.InvariantCulture)`. The method is recommended when a collection of strings must appear in a predictable order in a user interface control. - -> [!NOTE] -> This method does not modify the value of the current instance. Instead, it returns a new string in which all characters in the current instance are converted to uppercase. - -## Security Considerations - If you need the lowercase or uppercase version of an operating system identifier, such as a file name, named pipe, or registry key, use the or methods. - - - -## Examples - The following example defines a string array that contains a single word in a number of languages. The method is used to populate the elements of a parallel array with the case-insensitive version of each word. The method is used to sort the case-sensitive array based on the order of elements in the uppercase array to ensure that elements appear in the same order regardless of language. - - [!code-csharp[System.String.ToUpperInvariant#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.string.toupperinvariant/cs/toupperinvariant.cs#1)] - [!code-vb[System.String.ToUpperInvariant#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.string.toupperinvariant/vb/toupperinvariant.vb#1)] - - ]]> - - - - - - - - Method - - System.Runtime - 4.0.0.0 - 4.0.10.0 - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.String - - - - Removes all leading and trailing white-space characters from the current object. - The string that remains after all white-space characters are removed from the start and end of the current string. If no characters can be trimmed from the current instance, the method returns the current instance unchanged. - - method removes from the current string all leading and trailing white-space characters. Each leading and trailing trim operation stops when a non-white-space character is encountered. For example, if the current string is " abc xyz ", the method returns "abc xyz". To remove white-space characters between words in a string, use a [.NET Framework Regular Expressions](~/docs/standard/base-types/regular-expressions.md). - -> [!NOTE] -> If the method removes any characters from the current instance, this method does not modify the value of the current instance. Instead, it returns a new string in which all leading and trailing white space characters found in the current instance are removed. - - If the current string equals or all the characters in the current instance consist of white-space characters, the method returns . - - White-space characters are defined by the Unicode standard. The method removes any leading and trailing characters that produce a return value of `true` when they are passed to the method. - - - -## Examples - The following example uses the method to remove any extra white space from strings entered by the user before concatenating them. - - [!code-cpp[System.String.Trim#2](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim2.cpp#2)] - [!code-csharp[System.String.Trim#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Trim/cs/Trim2.cs#2)] - [!code-vb[System.String.Trim#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Trim/vb/Trim2.vb#2)] - - ]]> - - - The [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions maintain an internal list of white-space characters that this method trims. Starting with the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)], the method trims all Unicode white-space characters (that is, characters that produce a return value when they are passed to the method). Because of this change, the method in the [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions removes two characters, ZERO WIDTH SPACE (U+200B) and ZERO WIDTH NO-BREAK SPACE (U+FEFF), that the method in the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)]and later versions does not remove. In addition, the method in the [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions does not trim three Unicode white-space characters: MONGOLIAN VOWEL SEPARATOR (U+180E), NARROW NO-BREAK SPACE (U+202F), and MEDIUM MATHEMATICAL SPACE (U+205F). - - - - - - - - Method - - System.Runtime - 4.2.0.0 - - - System.String - - - - - - To be added. - To be added. - To be added. - To be added. - - - - - - - Method - - System.Runtime - 4.0.0.0 - 4.0.10.0 - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.String - - - - - - System.ParamArray - - - - - - An array of Unicode characters to remove, or . - Removes all leading and trailing occurrences of a set of characters specified in an array from the current object. - The string that remains after all occurrences of the characters in the parameter are removed from the start and end of the current string. If is or an empty array, white-space characters are removed instead. If no characters can be trimmed from the current instance, the method returns the current instance unchanged. - - method removes from the current string all leading and trailing characters that are in the `trimChars` parameter. Each leading and trailing trim operation stops when a character that is not in `trimChars` is encountered. For example, if the current string is "123abc456xyz789" and `trimChars` contains the digits from "1" through "9", the method returns "abc456xyz". - -> [!NOTE] -> If the method removes any characters from the current instance, this method does not modify the value of the current instance. Instead, it returns a new string in which all leading and trailing `trimChars` characters found in the current instance are removed. - - If the current string equals or all the characters in the current instance consist of characters in the `trimChars` array, the method returns . - - If `trimChars` is `null` or an empty array, this method removes any leading or trailing characters that result in the method returning `true` when they are passed to the method, - - - -## Examples - The following example uses the method to remove space, asterisk (*), and apostrophe (') characters from a string. - - [!code-cpp[System.String.Trim#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim1.cpp#1)] - [!code-csharp[System.String.Trim#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Trim/cs/Trim1.cs#1)] - [!code-vb[System.String.Trim#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Trim/vb/Trim1.vb#1)] - - ]]> - - - The [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions maintains an internal list of white-space characters that this method trims if is or an empty array. Starting with the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)], if is or an empty array, the method trims all Unicode white-space characters (that is, characters that produce a return value when they are passed to the method). Because of this change, the method in the [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions removes two characters, ZERO WIDTH SPACE (U+200B) and ZERO WIDTH NO-BREAK SPACE (U+FEFF), that the method in the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)]and later versions does not remove. In addition, the method in the [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions does not trim three Unicode white-space characters: MONGOLIAN VOWEL SEPARATOR (U+180E), NARROW NO-BREAK SPACE (U+202F), and MEDIUM MATHEMATICAL SPACE (U+205F). - - - - - - - - Method - - System.Runtime - 4.2.0.0 - - - System.String - - - - To be added. - To be added. - To be added. - - - - - - - Method - - System.Runtime - 4.2.0.0 - - - System.String - - - - - - To be added. - To be added. - To be added. - To be added. - - - - - - - Method - - System.Runtime - 4.0.0.0 - 4.0.10.0 - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.String - - - - - - System.ParamArray - - - - - - An array of Unicode characters to remove, or . - Removes all trailing occurrences of a set of characters specified in an array from the current object. - The string that remains after all occurrences of the characters in the parameter are removed from the end of the current string. If is or an empty array, Unicode white-space characters are removed instead. If no characters can be trimmed from the current instance, the method returns the current instance unchanged. - - method removes from the current string all trailing characters that are in the `trimChars` parameter. The trim operation stops when the first character that is not in `trimChars` is encountered at the end of the string. For example, if the current string is "123abc456xyz789" and `trimChars` contains the digits from "1" through "9", the method returns "123abc456xyz". - -> [!NOTE] -> If the method removes any characters from the current instance, this method does not modify the value of the current instance. Instead, it returns a new string in which all trailing characters found in `trimChars` are removed from the current string. - - - -## Examples - The following example demonstrates how you can use the method to trim white space or punctuation marks from the end of a string. - - [!code-csharp[System.String.TrimEnd#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.TrimEnd/cs/sample2.cs#2)] - [!code-vb[System.String.TrimEnd#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.TrimEnd/vb/Sample2.vb#2)] - - ]]> - - - The [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions maintains an internal list of white-space characters that this method trims if is or an empty array. Starting with the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)], if is or an empty array, the method trims all Unicode white-space characters (that is, characters that produce a return value when they are passed to the method). Because of this change, the method in the [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions removes two characters, ZERO WIDTH SPACE (U+200B) and ZERO WIDTH NO-BREAK SPACE (U+FEFF), that the method in the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)] and later versions does not remove. In addition, the method in the [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions does not trim three Unicode white-space characters: MONGOLIAN VOWEL SEPARATOR (U+180E), NARROW NO-BREAK SPACE (U+202F), and MEDIUM MATHEMATICAL SPACE (U+205F). - - - - - - - - Method - - System.Runtime - 4.2.0.0 - - - System.String - - - - To be added. - To be added. - To be added. - - - - - - - Method - - System.Runtime - 4.2.0.0 - - - System.String - - - - - - To be added. - To be added. - To be added. - To be added. - - - - - - - Method - - System.Runtime - 4.0.0.0 - 4.0.10.0 - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.String - - - - - - System.ParamArray - - - - - - An array of Unicode characters to remove, or . - Removes all leading occurrences of a set of characters specified in an array from the current object. - The string that remains after all occurrences of characters in the parameter are removed from the start of the current string. If is or an empty array, white-space characters are removed instead. - - method removes from the current string all leading characters that are in the `trimChars` parameter. The trim operation stops when a character that is not in `trimChars` is encountered. For example, if the current string is "123abc456xyz789" and `trimChars` contains the digits from "1" through "9", the method returns "abc456xyz789". - -> [!NOTE] -> If the method removes any characters from the current instance, this method does not modify the value of the current instance. Instead, it returns a new string in which all leading white space characters found in the current instance are removed. - - - -## Examples - The following example uses the method to trim white space and comment characters from lines of source code. The `StripComments` method wraps a call to and passes it a character array that contains a space and the comment character, which is an apostrophe ( ' ) in Visual Basic and a slash ( / ) in C#. The method is also called to remove leading white space when evaluating whether a string is a comment. - - [!code-csharp[System.String.TrimStart#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.TrimStart/cs/sample.cs#1)] - [!code-vb[System.String.TrimStart#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.TrimStart/vb/sample.vb#1)] - - The following example then illustrates a call to the `StripComments` method. - - [!code-csharp[System.String.TrimStart#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.TrimStart/cs/sample.cs#2)] - [!code-vb[System.String.TrimStart#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.TrimStart/vb/sample.vb#2)] - - ]]> - - - The [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions maintains an internal list of white-space characters that this method trims if is or an empty array. Starting with the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)], if is or an empty array, the method trims all Unicode white-space characters (that is, characters that produce a return value when they are passed to the method). Because of this change, the method in the [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions removes two characters, ZERO WIDTH SPACE (U+200B) and ZERO WIDTH NO-BREAK SPACE (U+FEFF), that the method in the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)] and later versions does not remove. In addition, the method in the [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions does not trim three Unicode white-space characters: MONGOLIAN VOWEL SEPARATOR (U+180E), NARROW NO-BREAK SPACE (U+202F), and MEDIUM MATHEMATICAL SPACE (U+205F). - - - - - + From 2fc2f611bab1aa7f048515efa15b75a08fc74adf Mon Sep 17 00:00:00 2001 From: Maira Wenzel Date: Fri, 15 Sep 2017 16:11:06 -0700 Subject: [PATCH 3/4] Update String.xml --- xml/System/String.xml | 780 +----------------------------------------- 1 file changed, 2 insertions(+), 778 deletions(-) diff --git a/xml/System/String.xml b/xml/System/String.xml index 8671b3b5c3c55..663639b929182 100644 --- a/xml/System/String.xml +++ b/xml/System/String.xml @@ -1,4 +1,4 @@ -fo + @@ -9318,780 +9318,4 @@ String 'This is a string.' in domain 'NewDomain': 75CC8236 ## Examples - The following example illustrates the difference in the arrays returned by calling a string's method with its `options` parameter equal to and . - - [!code-csharp[System.String.Split#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Split/cs/Split.cs#1)] - [!code-vb[System.String.Split#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Split/vb/Split.vb#1)] - - The following example defines an array of separators that include punctuation and white-space characters. Passing this array along with a value of to the method returns an array that consists of the individual words from the string. - - [!code-csharp[System.String.Split#7](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Split/cs/split7.cs#7)] - [!code-vb[System.String.Split#7](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Split/vb/split7.vb#7)] - - Note that the method is called with the `options` argument set to . This prevents the returned array from including values that represent empty substring matches between punctuation marks and white-space characters. - - ]]> - - - is not one of the values. - - In the [!INCLUDE[net_v35_short](~/includes/net-v35-short-md.md)] and earlier versions, if the method is passed a that is or contains no characters, the method uses a slightly different set of characters to split the string than the method does to trim the string. In the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)], both methods use an identical set of Unicode white-space characters. - - - - - - - - Method - - System.Runtime - 4.2.0.0 - - - System.String[] - - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - - - - - - - Method - - System.Runtime - 4.0.0.0 - 4.0.10.0 - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - - System.Runtime.InteropServices.ComVisible(false) - - - - System.String[] - - - - - - - - A character array that delimits the substrings in this string, an empty array that contains no delimiters, or . - The maximum number of substrings to return. - - to omit empty array elements from the array returned; or to include empty array elements in the array returned. - Splits a string into a maximum number of substrings based on the characters in an array. - An array whose elements contain the substrings in this string that are delimited by one or more characters in . For more information, see the Remarks section. - - method. However, if the `separator` parameter in the call to this method overload is `null`, compiler overload resolution fails. To unambiguously identify the called method, your code must indicate the type of the null. The following example shows several ways to unambiguously identify this overload. - - [!code-csharp[System.String.Split#3](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Split/cs/split3.cs#3)] - [!code-vb[System.String.Split#3](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Split/vb/split3.vb#3)] - - If the `count` parameter is zero, or the `options` parameter is and the length of this instance is zero, an empty array is returned. - - Each element of `separator` defines a separate delimiter character. If the `options` parameter is , and two delimiters are adjacent or a delimiter is found at the beginning or end of this instance, the corresponding array element contains . - - If there are more than `count` substrings in this instance, the first `count` minus 1 substrings are returned in the first `count` minus 1 elements of the return value, and the remaining characters in this instance are returned in the last element of the return value. - - If `count` is greater than the number of substrings, the available substrings are returned and no exception is thrown. - -## Performance Considerations - The methods allocate memory for the returned array object and a object for each array element. If your application requires optimal performance or if managing memory allocation is critical in your application, consider using the or method, and optionally the method, to locate a substring within a string. - - If you are splitting a string at a separator character, use the or method to locate a separator character in the string. If you are splitting a string at a separator string, use the or method to locate the first character of the separator string. Then use the method to determine whether the characters after that first character are equal to the remaining characters of the separator string. - - In addition, if the same set of characters is used to split strings in multiple method calls, consider creating a single array and referencing it in each method call. This significantly reduces the additional overhead of each method call. - - - -## Examples - The following example uses the enumeration to include or exclude substrings generated by the method. - - [!code-cpp[string.split3#1](~/samples/snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp#1)] - [!code-csharp[string.split3#1](~/samples/snippets/csharp/VS_Snippets_CLR/string.split3/CS/omit.cs#1)] - [!code-vb[string.split3#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/string.split3/VB/omit.vb#1)] - - ]]> - - - is negative. - - is not one of the values. - - In the [!INCLUDE[net_v35_short](~/includes/net-v35-short-md.md)] and earlier versions, if the method is passed a that is or contains no characters, the method uses a slightly different set of characters to split the string than the method does to trim the string. In the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)], both methods use an identical set of Unicode white-space characters. - - - - - - - - Method - - System.Runtime - 4.2.0.0 - - - System.String[] - - - - - - - - To be added. - To be added. - To be added. - To be added. - To be added. - To be added. - - - - - - - Method - - System.Runtime - 4.0.0.0 - 4.0.10.0 - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - - System.Runtime.InteropServices.ComVisible(false) - - - - System.String[] - - - - - - - - A string array that delimits the substrings in this string, an empty array that contains no delimiters, or . - The maximum number of substrings to return. - - to omit empty array elements from the array returned; or to include empty array elements in the array returned. - Splits a string into a maximum number of substrings based on the strings in an array. You can specify whether the substrings include empty array elements. - An array whose elements contain the substrings in this string that are delimited by one or more strings in . For more information, see the Remarks section. - - method. However, if the `separator` parameter in the call to this method overload is `null`, compiler overload resolution fails. To unambiguously identify the called method, your code must indicate the type of the `null`. The following example shows several ways to unambiguously identify this overload. - - [!code-csharp[System.String.Split#4](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Split/cs/split3.cs#4)] - [!code-vb[System.String.Split#4](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Split/vb/split3.vb#4)] - - If the `count` parameter is zero, or the `options` parameter is and the length of this instance is zero, an empty array is returned. - - Each element of `separator` defines a separate delimiter that consists of one or more characters. If the `options` parameter is , and two delimiters are adjacent or a delimiter is found at the beginning or end of this instance, the corresponding array element contains . - - If there are more than `count` substrings in this instance, the first `count` minus 1 substrings are returned in the first `count` minus 1 elements of the return value, and the remaining characters in this instance are returned in the last element of the return value. - - If `count` is greater than the number of substrings, the available substrings are returned and no exception is thrown. - -## The separator array - If any of the elements in `separator` consists of multiple characters, the entire substring is considered a delimiter. For example, if one of the elements in `separator` is "10", attempting to split the string "This10is10a10string." returns this four-element array: { "This", "is", "a", "string." }. - -## Comparison details - The method extracts the substrings in this string that are delimited by one or more of the strings in the `separator` parameter, and returns those substrings as elements of an array. - - The method looks for delimiters by performing comparisons using case-sensitive ordinal sort rules. For more information about word, string, and ordinal sorts, see the enumeration. - - The method ignores any element of `separator` whose value is `null` or the empty string (""). - - To avoid ambiguous results when strings in `separator` have characters in common, the method proceeds from the beginning to the end of the value of the instance, and matches the first element in `separator` that is equal to a delimiter in the instance. The order in which substrings are encountered in the instance takes precedence over the order of elements in `separator`. - - For example, consider an instance whose value is "abcdef". If the first element in `separator` was "ef" and the second element was "bcde", the result of the split operation would be "a" and "f". This is because the substring in the instance, "bcde", is encountered and matches an element in `separator` before the substring "f" is encountered. - - However, if the first element of `separator` was "bcd" and the second element was "bc", the result of the split operation would be "a" and "ef". This is because "bcd" is the first delimiter in `separator` that matches a delimiter in the instance. If the order of the separators was reversed so the first element was "bc" and the second element was "bcd", the result would be "a" and "def". - -## Performance considerations - The methods allocate memory for the returned array object and a object for each array element. If your application requires optimal performance or if managing memory allocation is critical in your application, consider using the or method, and optionally the method, to locate a substring within a string. - - If you are splitting a string at a separator character, use the or method to locate a separator character in the string. If you are splitting a string at a separator string, use the or method to locate the first character of the separator string. Then use the method to determine whether the characters after that first character are equal to the remaining characters of the separator string. - - In addition, if the same set of characters is used to split strings in multiple method calls, consider creating a single array and referencing it in each method call. This significantly reduces the additional overhead of each method call. - - - -## Examples - The following example uses the enumeration to include or exclude substrings generated by the method. - - [!code-cpp[string.split3#1](~/samples/snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp#1)] - [!code-csharp[string.split3#1](~/samples/snippets/csharp/VS_Snippets_CLR/string.split3/CS/omit.cs#1)] - [!code-vb[string.split3#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/string.split3/VB/omit.vb#1)] - - ]]> - - - is negative. - - is not one of the values. - - In the [!INCLUDE[net_v35_short](~/includes/net-v35-short-md.md)] and earlier versions, if the method is passed a that is or contains no characters, the method uses a slightly different set of characters to split the string than the method does to trim the string. In the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)], both methods use an identical set of Unicode white-space characters. - - - - - - - - Method - - System.Runtime - 4.2.0.0 - - - System.Boolean - - - - - - To be added. - To be added. - To be added. - To be added. - - - - - - - Method - - System.Runtime - 4.0.0.0 - 4.0.10.0 - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.Boolean - - - - - - The string to compare. - Determines whether the beginning of this string instance matches the specified string. - - if matches the beginning of this string; otherwise, . - - ), must be a reference to this same instance, or must match the beginning of this instance. - - This method performs a word (case-sensitive and culture-sensitive) comparison using the current culture. - - - -## Examples - The following example defines a `StripStartTags` method that uses the method to remove HTML start tags from the beginning of a string. Note that the `StripStartTags` method is called recursively to ensure that multiple HTML start tags at the beginning of the line are removed. The example does not remove HTML tags embedded in a string. - - [!code-cpp[stringstartswith#1](~/samples/snippets/cpp/VS_Snippets_CLR/stringstartswith/CPP/stringstartswith.cpp#1)] - [!code-csharp[stringstartswith#1](~/samples/snippets/csharp/VS_Snippets_CLR/stringstartswith/CS/stringstartswith.cs#1)] - [!code-vb[stringstartswith#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/stringstartswith/VB/stringstartswith.vb#1)] - - ]]> - - - is . - - As explained in [Best Practices for Using Strings](~/docs/standard/base-types/best-practices-strings.md), we recommend that you avoid calling string comparison methods that substitute default values and instead call methods that require parameters to be explicitly specified. To determine whether a string begins with a particular substring by using the string comparison rules of the current culture, call the method overload with a value of for its parameter. - - - - - - - - Method - - System.Runtime - 4.0.0.0 - 4.0.10.0 - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - - System.Runtime.InteropServices.ComVisible(false) - - - System.Security.SecuritySafeCritical - - - - System.Boolean - - - - - - - The string to compare. - One of the enumeration values that determines how this string and value are compared. - Determines whether the beginning of this string instance matches the specified string when compared using the specified comparison option. - - if this instance begins with ; otherwise, . - - method compares the `value` parameter to the substring at the beginning of this string and returns a value that indicates whether they are equal. To be equal, `value` must be a reference to this same string, must be the empty string (""), or must match the beginning of this string. The type of comparison performed by the method depends on the value of the `comparisonType` parameter. The comparison can use the conventions of the current culture ( and ) or the invariant culture ( and ), or it can consist of a character-by-character comparison of code points ( or ). The comparison can also be case-sensitive (, , or ), or it can ignore case (, , ). - - - -## Examples - The following example searches for the string "the" at the beginning of a longer string that begins with the word "The". As the output from the example shows, a call to the method that performs a culture-insensitive but case-sensitive comparison fails to match the string, while a call that performs a culture- and case-insensitive comparison matches the string. - - [!code-cpp[System.String.StartsWith#2](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/StartsWith2.cpp#2)] - [!code-csharp[System.String.StartsWith#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.string.startswith/cs/StartsWith2.cs#2)] - [!code-vb[System.String.StartsWith#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.string.startswith/vb/StartsWith2.vb#2)] - - The following example determines whether a string starts with a particular substring. It initializes a two-dimensional string array. The first element in the second dimension contains a string, and the second element contains the string to search for at the start of the first string. The results are affected by the choice of culture, whether case is ignored, and whether an ordinal comparison is performed. Note that when the string instance contains a ligature, culture-sensitive comparisons with its consecutive characters successfully match. - - [!code-cpp[System.String.StartsWith#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/startswith1.cpp#1)] - [!code-csharp[System.String.StartsWith#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.string.startswith/cs/startswith1.cs#1)] - [!code-vb[System.String.StartsWith#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.string.startswith/vb/startswith1.vb#1)] - - ]]> - - - is . - - is not a value. - - - - - - - Method - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.Runtime - 4.2.0.0 - - - System.Boolean - - - - - - - - The string to compare. - - to ignore case during the comparison; otherwise, . - Cultural information that determines how this string and value are compared. If culture is , the current culture is used. - Determines whether the beginning of this string instance matches the specified string when compared using the specified culture. - - if the parameter matches the beginning of this string; otherwise, . - - ), must be a reference to this same instance, or must match the beginning of this instance. - - This method performs a comparison using the specified casing and culture. - - - -## Examples - The following example determines whether a string occurs at the beginning of another string. The method is called several times using case sensitivity, case insensitivity, and different cultures that influence the results of the search. - - [!code-csharp[system.string.StartsWithCI#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.string.StartsWithCI/cs/swci.cs#1)] - [!code-vb[system.string.StartsWithCI#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.string.StartsWithCI/vb/swci.vb#1)] - - ]]> - - - is . - - - - - - - Method - - System.Runtime - 4.0.0.0 - 4.0.10.0 - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.String - - - - - - The zero-based starting character position of a substring in this instance. - Retrieves a substring from this instance. The substring starts at a specified character position and continues to the end of the string. - A string that is equivalent to the substring that begins at in this instance, or if is equal to the length of this instance. - - method to extract a substring from a string that begins at a specified character position and ends at the end of the string. The starting character position is a zero-based; in other words, the first character in the string is at index 0, not index 1. To extract a substring that begins at a specified character position and ends before to the end of the string, call the method. - -> [!NOTE] -> This method does not modify the value of the current instance. Instead, it returns a new string that begins at the `startIndex` position in the current string. - - To extract a substring that begins with a particular character or character sequence, call a method such as or to get the value of `startIndex`. The second example illustrates this; it extracts a key value that begins one character position after the "=" character. - - If `startIndex` is equal to zero, the method returns the original string unchanged. - - - -## Examples - The following example demonstrates obtaining a substring from a string. - - [!code-cpp[System.String.Substring#10](~/samples/snippets/cpp/VS_Snippets_CLR_System/System.String.Substring/cpp/Substring10.cpp#10)] - [!code-csharp[System.String.Substring#10](~/samples/snippets/csharp/VS_Snippets_CLR_System/System.String.Substring/cs/Substring10.cs#10)] - [!code-vb[System.String.Substring#10](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.String.Substring/vb/Substring10.vb#10)] - - The following example uses the method to separate key/value pairs that are delimited by an equals ("=") character. - - [!code-csharp[System.String.Substring#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/System.String.Substring/cs/Substring1.cs#1)] - [!code-vb[System.String.Substring#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.String.Substring/vb/Substring1.vb#1)] - - The method is used to get the position of the equals character in the string.. The call to the method extracts the key name., which starts from the first character in the string and extends for the number of characters returned by the call to the method. The call to the method then extracts the value assigned to the key. It starts at one character position beyond the equals character and extends to the end of the string. - - ]]> - - - is less than zero or greater than the length of this instance. - - - - - - - Method - - System.Runtime - 4.0.0.0 - 4.0.10.0 - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - - System.Security.SecuritySafeCritical - - - - System.String - - - - - - - The zero-based starting character position of a substring in this instance. - The number of characters in the substring. - Retrieves a substring from this instance. The substring starts at a specified character position and has a specified length. - A string that is equivalent to the substring of length that begins at in this instance, or if is equal to the length of this instance and is zero. - - method to extract a substring from a string that begins at a specified character position and ends before the end of the string. The starting character position is a zero-based; in other words, the first character in the string is at index 0, not index 1. To extract a substring that begins at a specified character position and continues to the end of the string, call the method. - -> [!NOTE] -> This method does not modify the value of the current instance. Instead, it returns a new string with `length` characters starting from the `startIndex` position in the current string. - - The `length` parameter represents the total number of characters to extract from the current string instance. This includes the starting character found at index `startIndex`. In other words, the method attempts to extract characters from index `startIndex` to index `startIndex` + `length` - 1. - - To extract a substring that begins with a particular character or character sequence, call a method such as or to get the value of `startIndex`. - - If the substring extends from `startIndex` to a specified character sequence, you can call a method such as or to get the index of the ending character or character sequence. You can then convert that value to an index position in the string as follows: - -- If you've searched for a single character that is to mark the end of the substring, the `length` parameter equals `endIndex` - `startIndex` + 1, where `endIndex` is the return value of the or method. The following example extracts a continuous block of "b" characters from a string. - - [!code-csharp[System.String.Substring#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/System.String.Substring/cs/Substring2.cs#2)] - [!code-vb[System.String.Substring#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.String.Substring/vb/Substring2.vb#2)] - -- If you've searched for multiple characters that are to mark the end of the substring, the `length` parameter equals `endIndex` + `endMatchLength` - `startIndex`, where `endIndex` is the return value of the or method., and `endMatchLength` is the length of the character sequence that marks the end of the substring. The following example extracts a block of text that contains an XML `` element. - - [!code-csharp[System.String.Substring#3](~/samples/snippets/csharp/VS_Snippets_CLR_System/System.String.Substring/cs/Substring3.cs#3)] - [!code-vb[System.String.Substring#3](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.String.Substring/vb/Substring3.vb#3)] - -- If the character or character sequence is not included in the end of the substring, the `length` parameter equals `endIndex` - `startIndex`, where `endIndex` is the return value of the or method. - - If `startIndex` is equal to zero and equals the length of the current string, the method returns the original string unchanged. - - - -## Examples - The following example illustrates a simple call to the method that extracts two characters from a string starting at the sixth character position (that is, at index five). - - [!code-csharp[System.String.Substring#4](~/samples/snippets/csharp/VS_Snippets_CLR_System/System.String.Substring/cs/Substring4.cs#4)] - [!code-vb[System.String.Substring#4](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.String.Substring/vb/Substring4.vb#4)] - - The following example uses the method in the following three cases to isolate substrings within a string. In two cases the substrings are used in comparisons, and in the third case an exception is thrown because invalid parameters are specified. - -- It extracts the single character and the third position in the string (at index 2) and compares it with a "c". This comparison returns `true`. - -- It extracts zero characters starting at the fourth position in the string (at index 3) and passes it to the method. This returns true because the call to the method returns . - -- It attempts to extract one character starting at the fourth position in the string. Because there is no character at that position, the method call throws an exception. - - [!code-csharp[Classic String.Substring1 Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic String.Substring1 Example/CS/source.cs#1)] - [!code-vb[Classic String.Substring1 Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic String.Substring1 Example/VB/source.vb#1)] - - The following example uses the method to separate key/value pairs that are delimited by an equals ("=") character. - - [!code-csharp[System.String.Substring#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/System.String.Substring/cs/Substring1.cs#1)] - [!code-vb[System.String.Substring#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.String.Substring/vb/Substring1.vb#1)] - - The method is used to get the position of the equals character in the string.. The call to the method extracts the key name., which starts from the first character in the string and extends for the number of characters returned by the call to the method. The call to the method then extracts the value assigned to the key. It starts at one character position beyond the equals character and extends to the end of the string. - - ]]> - - - plus indicates a position not within this instance. - - -or- - - or is less than zero. - - - - - - - Method - - System.Runtime - 4.0.10.0 - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.Collections.Generic.IEnumerator<System.Char> - - - - Returns an enumerator that iterates through the current object. - A strongly-typed enumerator that can be used to iterate through the current object. - - instance is cast to an interface object. For more information, see the method. - - ]]> - - - - - - - - Method - - System.Runtime - 4.0.0.0 - 4.0.10.0 - 4.0.20.0 - 4.1.0.0 - 4.2.0.0 - - - mscorlib - 2.0.5.0 - 4.0.0.0 - - - netstandard - 2.0.0.0 - - - System.Collections.IEnumerator - - - - Returns an enumerator that iterates through the current object. - An enumerator that can be used to iterate through the current string. - - instance is cast to an interface. For more information, see the method. - - ]]> - - - - - - - - Method - - System.Runtime - 4.0.0.0 - 4.0.10.0 - 4.0.20.0 - 4.1.0.0 - - - System.Int32 - - - - - - To be added. - To be added. - To be added. - To be added. - - - - - - - Method - - System.Runtime - 4.0.20.0 - 4.1.0.0 - - - System.TypeCode - - - - To be added. - To be added. - To be added. - - - - - - - Method - - System.Runtime - + The following example illustrates the difference in the arrays returned by calling a string's Date: Fri, 15 Sep 2017 16:13:54 -0700 Subject: [PATCH 4/4] Update String.xml --- xml/System/String.xml | 2349 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 2348 insertions(+), 1 deletion(-) diff --git a/xml/System/String.xml b/xml/System/String.xml index 663639b929182..e17709bb2615f 100644 --- a/xml/System/String.xml +++ b/xml/System/String.xml @@ -9318,4 +9318,2351 @@ String 'This is a string.' in domain 'NewDomain': 75CC8236 ## Examples - The following example illustrates the difference in the arrays returned by calling a string's method with its `options` parameter equal to and . + + [!code-csharp[System.String.Split#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Split/cs/Split.cs#1)] + [!code-vb[System.String.Split#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Split/vb/Split.vb#1)] + + The following example defines an array of separators that include punctuation and white-space characters. Passing this array along with a value of to the method returns an array that consists of the individual words from the string. + + [!code-csharp[System.String.Split#7](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Split/cs/split7.cs#7)] + [!code-vb[System.String.Split#7](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Split/vb/split7.vb#7)] + + Note that the method is called with the `options` argument set to . This prevents the returned array from including values that represent empty substring matches between punctuation marks and white-space characters. + + ]]> + + + is not one of the values. + + In the [!INCLUDE[net_v35_short](~/includes/net-v35-short-md.md)] and earlier versions, if the method is passed a that is or contains no characters, the method uses a slightly different set of characters to split the string than the method does to trim the string. In the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)], both methods use an identical set of Unicode white-space characters. + + + + + + + + Method + + System.Runtime + 4.2.0.0 + + + System.String[] + + + + + + + + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + + + + + + + Method + + System.Runtime + 4.0.0.0 + 4.0.10.0 + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + + System.Runtime.InteropServices.ComVisible(false) + + + + System.String[] + + + + + + + + A character array that delimits the substrings in this string, an empty array that contains no delimiters, or . + The maximum number of substrings to return. + + to omit empty array elements from the array returned; or to include empty array elements in the array returned. + Splits a string into a maximum number of substrings based on the characters in an array. + An array whose elements contain the substrings in this string that are delimited by one or more characters in . For more information, see the Remarks section. + + method. However, if the `separator` parameter in the call to this method overload is `null`, compiler overload resolution fails. To unambiguously identify the called method, your code must indicate the type of the null. The following example shows several ways to unambiguously identify this overload. + + [!code-csharp[System.String.Split#3](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Split/cs/split3.cs#3)] + [!code-vb[System.String.Split#3](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Split/vb/split3.vb#3)] + + If the `count` parameter is zero, or the `options` parameter is and the length of this instance is zero, an empty array is returned. + + Each element of `separator` defines a separate delimiter character. If the `options` parameter is , and two delimiters are adjacent or a delimiter is found at the beginning or end of this instance, the corresponding array element contains . + + If there are more than `count` substrings in this instance, the first `count` minus 1 substrings are returned in the first `count` minus 1 elements of the return value, and the remaining characters in this instance are returned in the last element of the return value. + + If `count` is greater than the number of substrings, the available substrings are returned and no exception is thrown. + +## Performance Considerations + The methods allocate memory for the returned array object and a object for each array element. If your application requires optimal performance or if managing memory allocation is critical in your application, consider using the or method, and optionally the method, to locate a substring within a string. + + If you are splitting a string at a separator character, use the or method to locate a separator character in the string. If you are splitting a string at a separator string, use the or method to locate the first character of the separator string. Then use the method to determine whether the characters after that first character are equal to the remaining characters of the separator string. + + In addition, if the same set of characters is used to split strings in multiple method calls, consider creating a single array and referencing it in each method call. This significantly reduces the additional overhead of each method call. + + + +## Examples + The following example uses the enumeration to include or exclude substrings generated by the method. + + [!code-cpp[string.split3#1](~/samples/snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp#1)] + [!code-csharp[string.split3#1](~/samples/snippets/csharp/VS_Snippets_CLR/string.split3/CS/omit.cs#1)] + [!code-vb[string.split3#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/string.split3/VB/omit.vb#1)] + + ]]> + + + is negative. + + is not one of the values. + + In the [!INCLUDE[net_v35_short](~/includes/net-v35-short-md.md)] and earlier versions, if the method is passed a that is or contains no characters, the method uses a slightly different set of characters to split the string than the method does to trim the string. In the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)], both methods use an identical set of Unicode white-space characters. + + + + + + + + Method + + System.Runtime + 4.2.0.0 + + + System.String[] + + + + + + + + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + + + + + + + Method + + System.Runtime + 4.0.0.0 + 4.0.10.0 + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + + System.Runtime.InteropServices.ComVisible(false) + + + + System.String[] + + + + + + + + A string array that delimits the substrings in this string, an empty array that contains no delimiters, or . + The maximum number of substrings to return. + + to omit empty array elements from the array returned; or to include empty array elements in the array returned. + Splits a string into a maximum number of substrings based on the strings in an array. You can specify whether the substrings include empty array elements. + An array whose elements contain the substrings in this string that are delimited by one or more strings in . For more information, see the Remarks section. + + method. However, if the `separator` parameter in the call to this method overload is `null`, compiler overload resolution fails. To unambiguously identify the called method, your code must indicate the type of the `null`. The following example shows several ways to unambiguously identify this overload. + + [!code-csharp[System.String.Split#4](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Split/cs/split3.cs#4)] + [!code-vb[System.String.Split#4](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Split/vb/split3.vb#4)] + + If the `count` parameter is zero, or the `options` parameter is and the length of this instance is zero, an empty array is returned. + + Each element of `separator` defines a separate delimiter that consists of one or more characters. If the `options` parameter is , and two delimiters are adjacent or a delimiter is found at the beginning or end of this instance, the corresponding array element contains . + + If there are more than `count` substrings in this instance, the first `count` minus 1 substrings are returned in the first `count` minus 1 elements of the return value, and the remaining characters in this instance are returned in the last element of the return value. + + If `count` is greater than the number of substrings, the available substrings are returned and no exception is thrown. + +## The separator array + If any of the elements in `separator` consists of multiple characters, the entire substring is considered a delimiter. For example, if one of the elements in `separator` is "10", attempting to split the string "This10is10a10string." returns this four-element array: { "This", "is", "a", "string." }. + +## Comparison details + The method extracts the substrings in this string that are delimited by one or more of the strings in the `separator` parameter, and returns those substrings as elements of an array. + + The method looks for delimiters by performing comparisons using case-sensitive ordinal sort rules. For more information about word, string, and ordinal sorts, see the enumeration. + + The method ignores any element of `separator` whose value is `null` or the empty string (""). + + To avoid ambiguous results when strings in `separator` have characters in common, the method proceeds from the beginning to the end of the value of the instance, and matches the first element in `separator` that is equal to a delimiter in the instance. The order in which substrings are encountered in the instance takes precedence over the order of elements in `separator`. + + For example, consider an instance whose value is "abcdef". If the first element in `separator` was "ef" and the second element was "bcde", the result of the split operation would be "a" and "f". This is because the substring in the instance, "bcde", is encountered and matches an element in `separator` before the substring "f" is encountered. + + However, if the first element of `separator` was "bcd" and the second element was "bc", the result of the split operation would be "a" and "ef". This is because "bcd" is the first delimiter in `separator` that matches a delimiter in the instance. If the order of the separators was reversed so the first element was "bc" and the second element was "bcd", the result would be "a" and "def". + +## Performance considerations + The methods allocate memory for the returned array object and a object for each array element. If your application requires optimal performance or if managing memory allocation is critical in your application, consider using the or method, and optionally the method, to locate a substring within a string. + + If you are splitting a string at a separator character, use the or method to locate a separator character in the string. If you are splitting a string at a separator string, use the or method to locate the first character of the separator string. Then use the method to determine whether the characters after that first character are equal to the remaining characters of the separator string. + + In addition, if the same set of characters is used to split strings in multiple method calls, consider creating a single array and referencing it in each method call. This significantly reduces the additional overhead of each method call. + + + +## Examples + The following example uses the enumeration to include or exclude substrings generated by the method. + + [!code-cpp[string.split3#1](~/samples/snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp#1)] + [!code-csharp[string.split3#1](~/samples/snippets/csharp/VS_Snippets_CLR/string.split3/CS/omit.cs#1)] + [!code-vb[string.split3#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/string.split3/VB/omit.vb#1)] + + ]]> + + + is negative. + + is not one of the values. + + In the [!INCLUDE[net_v35_short](~/includes/net-v35-short-md.md)] and earlier versions, if the method is passed a that is or contains no characters, the method uses a slightly different set of characters to split the string than the method does to trim the string. In the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)], both methods use an identical set of Unicode white-space characters. + + + + + + + + Method + + System.Runtime + 4.2.0.0 + + + System.Boolean + + + + + + To be added. + To be added. + To be added. + To be added. + + + + + + + Method + + System.Runtime + 4.0.0.0 + 4.0.10.0 + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.Boolean + + + + + + The string to compare. + Determines whether the beginning of this string instance matches the specified string. + + if matches the beginning of this string; otherwise, . + + ), must be a reference to this same instance, or must match the beginning of this instance. + + This method performs a word (case-sensitive and culture-sensitive) comparison using the current culture. + + + +## Examples + The following example defines a `StripStartTags` method that uses the method to remove HTML start tags from the beginning of a string. Note that the `StripStartTags` method is called recursively to ensure that multiple HTML start tags at the beginning of the line are removed. The example does not remove HTML tags embedded in a string. + + [!code-cpp[stringstartswith#1](~/samples/snippets/cpp/VS_Snippets_CLR/stringstartswith/CPP/stringstartswith.cpp#1)] + [!code-csharp[stringstartswith#1](~/samples/snippets/csharp/VS_Snippets_CLR/stringstartswith/CS/stringstartswith.cs#1)] + [!code-vb[stringstartswith#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/stringstartswith/VB/stringstartswith.vb#1)] + + ]]> + + + is . + + As explained in [Best Practices for Using Strings](~/docs/standard/base-types/best-practices-strings.md), we recommend that you avoid calling string comparison methods that substitute default values and instead call methods that require parameters to be explicitly specified. To determine whether a string begins with a particular substring by using the string comparison rules of the current culture, call the method overload with a value of for its parameter. + + + + + + + + Method + + System.Runtime + 4.0.0.0 + 4.0.10.0 + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + + System.Runtime.InteropServices.ComVisible(false) + + + System.Security.SecuritySafeCritical + + + + System.Boolean + + + + + + + The string to compare. + One of the enumeration values that determines how this string and value are compared. + Determines whether the beginning of this string instance matches the specified string when compared using the specified comparison option. + + if this instance begins with ; otherwise, . + + method compares the `value` parameter to the substring at the beginning of this string and returns a value that indicates whether they are equal. To be equal, `value` must be a reference to this same string, must be the empty string (""), or must match the beginning of this string. The type of comparison performed by the method depends on the value of the `comparisonType` parameter. The comparison can use the conventions of the current culture ( and ) or the invariant culture ( and ), or it can consist of a character-by-character comparison of code points ( or ). The comparison can also be case-sensitive (, , or ), or it can ignore case (, , ). + + + +## Examples + The following example searches for the string "the" at the beginning of a longer string that begins with the word "The". As the output from the example shows, a call to the method that performs a culture-insensitive but case-sensitive comparison fails to match the string, while a call that performs a culture- and case-insensitive comparison matches the string. + + [!code-cpp[System.String.StartsWith#2](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/StartsWith2.cpp#2)] + [!code-csharp[System.String.StartsWith#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.string.startswith/cs/StartsWith2.cs#2)] + [!code-vb[System.String.StartsWith#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.string.startswith/vb/StartsWith2.vb#2)] + + The following example determines whether a string starts with a particular substring. It initializes a two-dimensional string array. The first element in the second dimension contains a string, and the second element contains the string to search for at the start of the first string. The results are affected by the choice of culture, whether case is ignored, and whether an ordinal comparison is performed. Note that when the string instance contains a ligature, culture-sensitive comparisons with its consecutive characters successfully match. + + [!code-cpp[System.String.StartsWith#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/startswith1.cpp#1)] + [!code-csharp[System.String.StartsWith#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.string.startswith/cs/startswith1.cs#1)] + [!code-vb[System.String.StartsWith#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.string.startswith/vb/startswith1.vb#1)] + + ]]> + + + is . + + is not a value. + + + + + + + Method + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.Runtime + 4.2.0.0 + + + System.Boolean + + + + + + + + The string to compare. + + to ignore case during the comparison; otherwise, . + Cultural information that determines how this string and value are compared. If culture is , the current culture is used. + Determines whether the beginning of this string instance matches the specified string when compared using the specified culture. + + if the parameter matches the beginning of this string; otherwise, . + + ), must be a reference to this same instance, or must match the beginning of this instance. + + This method performs a comparison using the specified casing and culture. + + + +## Examples + The following example determines whether a string occurs at the beginning of another string. The method is called several times using case sensitivity, case insensitivity, and different cultures that influence the results of the search. + + [!code-csharp[system.string.StartsWithCI#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.string.StartsWithCI/cs/swci.cs#1)] + [!code-vb[system.string.StartsWithCI#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.string.StartsWithCI/vb/swci.vb#1)] + + ]]> + + + is . + + + + + + + Method + + System.Runtime + 4.0.0.0 + 4.0.10.0 + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.String + + + + + + The zero-based starting character position of a substring in this instance. + Retrieves a substring from this instance. The substring starts at a specified character position and continues to the end of the string. + A string that is equivalent to the substring that begins at in this instance, or if is equal to the length of this instance. + + method to extract a substring from a string that begins at a specified character position and ends at the end of the string. The starting character position is a zero-based; in other words, the first character in the string is at index 0, not index 1. To extract a substring that begins at a specified character position and ends before to the end of the string, call the method. + +> [!NOTE] +> This method does not modify the value of the current instance. Instead, it returns a new string that begins at the `startIndex` position in the current string. + + To extract a substring that begins with a particular character or character sequence, call a method such as or to get the value of `startIndex`. The second example illustrates this; it extracts a key value that begins one character position after the "=" character. + + If `startIndex` is equal to zero, the method returns the original string unchanged. + + + +## Examples + The following example demonstrates obtaining a substring from a string. + + [!code-cpp[System.String.Substring#10](~/samples/snippets/cpp/VS_Snippets_CLR_System/System.String.Substring/cpp/Substring10.cpp#10)] + [!code-csharp[System.String.Substring#10](~/samples/snippets/csharp/VS_Snippets_CLR_System/System.String.Substring/cs/Substring10.cs#10)] + [!code-vb[System.String.Substring#10](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.String.Substring/vb/Substring10.vb#10)] + + The following example uses the method to separate key/value pairs that are delimited by an equals ("=") character. + + [!code-csharp[System.String.Substring#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/System.String.Substring/cs/Substring1.cs#1)] + [!code-vb[System.String.Substring#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.String.Substring/vb/Substring1.vb#1)] + + The method is used to get the position of the equals character in the string.. The call to the method extracts the key name., which starts from the first character in the string and extends for the number of characters returned by the call to the method. The call to the method then extracts the value assigned to the key. It starts at one character position beyond the equals character and extends to the end of the string. + + ]]> + + + is less than zero or greater than the length of this instance. + + + + + + + Method + + System.Runtime + 4.0.0.0 + 4.0.10.0 + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + + System.Security.SecuritySafeCritical + + + + System.String + + + + + + + The zero-based starting character position of a substring in this instance. + The number of characters in the substring. + Retrieves a substring from this instance. The substring starts at a specified character position and has a specified length. + A string that is equivalent to the substring of length that begins at in this instance, or if is equal to the length of this instance and is zero. + + method to extract a substring from a string that begins at a specified character position and ends before the end of the string. The starting character position is a zero-based; in other words, the first character in the string is at index 0, not index 1. To extract a substring that begins at a specified character position and continues to the end of the string, call the method. + +> [!NOTE] +> This method does not modify the value of the current instance. Instead, it returns a new string with `length` characters starting from the `startIndex` position in the current string. + + The `length` parameter represents the total number of characters to extract from the current string instance. This includes the starting character found at index `startIndex`. In other words, the method attempts to extract characters from index `startIndex` to index `startIndex` + `length` - 1. + + To extract a substring that begins with a particular character or character sequence, call a method such as or to get the value of `startIndex`. + + If the substring extends from `startIndex` to a specified character sequence, you can call a method such as or to get the index of the ending character or character sequence. You can then convert that value to an index position in the string as follows: + +- If you've searched for a single character that is to mark the end of the substring, the `length` parameter equals `endIndex` - `startIndex` + 1, where `endIndex` is the return value of the or method. The following example extracts a continuous block of "b" characters from a string. + + [!code-csharp[System.String.Substring#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/System.String.Substring/cs/Substring2.cs#2)] + [!code-vb[System.String.Substring#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.String.Substring/vb/Substring2.vb#2)] + +- If you've searched for multiple characters that are to mark the end of the substring, the `length` parameter equals `endIndex` + `endMatchLength` - `startIndex`, where `endIndex` is the return value of the or method., and `endMatchLength` is the length of the character sequence that marks the end of the substring. The following example extracts a block of text that contains an XML `` element. + + [!code-csharp[System.String.Substring#3](~/samples/snippets/csharp/VS_Snippets_CLR_System/System.String.Substring/cs/Substring3.cs#3)] + [!code-vb[System.String.Substring#3](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.String.Substring/vb/Substring3.vb#3)] + +- If the character or character sequence is not included in the end of the substring, the `length` parameter equals `endIndex` - `startIndex`, where `endIndex` is the return value of the or method. + + If `startIndex` is equal to zero and equals the length of the current string, the method returns the original string unchanged. + + + +## Examples + The following example illustrates a simple call to the method that extracts two characters from a string starting at the sixth character position (that is, at index five). + + [!code-csharp[System.String.Substring#4](~/samples/snippets/csharp/VS_Snippets_CLR_System/System.String.Substring/cs/Substring4.cs#4)] + [!code-vb[System.String.Substring#4](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.String.Substring/vb/Substring4.vb#4)] + + The following example uses the method in the following three cases to isolate substrings within a string. In two cases the substrings are used in comparisons, and in the third case an exception is thrown because invalid parameters are specified. + +- It extracts the single character and the third position in the string (at index 2) and compares it with a "c". This comparison returns `true`. + +- It extracts zero characters starting at the fourth position in the string (at index 3) and passes it to the method. This returns true because the call to the method returns . + +- It attempts to extract one character starting at the fourth position in the string. Because there is no character at that position, the method call throws an exception. + + [!code-csharp[Classic String.Substring1 Example#1](~/samples/snippets/csharp/VS_Snippets_CLR_Classic/classic String.Substring1 Example/CS/source.cs#1)] + [!code-vb[Classic String.Substring1 Example#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_Classic/classic String.Substring1 Example/VB/source.vb#1)] + + The following example uses the method to separate key/value pairs that are delimited by an equals ("=") character. + + [!code-csharp[System.String.Substring#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/System.String.Substring/cs/Substring1.cs#1)] + [!code-vb[System.String.Substring#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/System.String.Substring/vb/Substring1.vb#1)] + + The method is used to get the position of the equals character in the string.. The call to the method extracts the key name., which starts from the first character in the string and extends for the number of characters returned by the call to the method. The call to the method then extracts the value assigned to the key. It starts at one character position beyond the equals character and extends to the end of the string. + + ]]> + + + plus indicates a position not within this instance. + + -or- + + or is less than zero. + + + + + + + Method + + System.Runtime + 4.0.10.0 + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.Collections.Generic.IEnumerator<System.Char> + + + + Returns an enumerator that iterates through the current object. + A strongly-typed enumerator that can be used to iterate through the current object. + + instance is cast to an interface object. For more information, see the method. + + ]]> + + + + + + + + Method + + System.Runtime + 4.0.0.0 + 4.0.10.0 + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.Collections.IEnumerator + + + + Returns an enumerator that iterates through the current object. + An enumerator that can be used to iterate through the current string. + + instance is cast to an interface. For more information, see the method. + + ]]> + + + + + + + + Method + + System.Runtime + 4.0.0.0 + 4.0.10.0 + 4.0.20.0 + 4.1.0.0 + + + System.Int32 + + + + + + To be added. + To be added. + To be added. + To be added. + + + + + + + Method + + System.Runtime + 4.0.20.0 + 4.1.0.0 + + + System.TypeCode + + + + To be added. + To be added. + To be added. + + + + + + + Method + + System.Runtime + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.Boolean + + + + + + This parameter is ignored. + For a description of this member, see . + + if the value of the current string is ; if the value of the current string is . + + instance is cast to an interface. The recommended alternative is to call the method. + + ]]> + + The value of the current string is not or . + + + + + + + Method + + System.Runtime + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.Byte + + + + + + An object that provides culture-specific formatting information. + For a description of this member, see . + The converted value of the current object. + + instance is cast to an interface. The recommended alternative is to call the method. + + ]]> + + The value of the current object cannot be parsed. + The value of the current object is a number greater than or less than . + + + + + + + Method + + System.Runtime + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.Char + + + + + + An object that provides culture-specific formatting information. + For a description of this member, see . + The character at index 0 in the current object. + + instance is cast to an interface. The recommended alternative is to call the method. + + ]]> + + + + + + + + Method + + System.Runtime + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.DateTime + + + + + + An object that provides culture-specific formatting information. + For a description of this member, see . + The converted value of the current object. + + instance is cast to an interface. The recommended alternative is to call the method. + + ]]> + + + + + + + + Method + + System.Runtime + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.Decimal + + + + + + An object that provides culture-specific formatting information. + For a description of this member, see . + The converted value of the current object. + + instance is cast to an interface. The recommended alternative is to call the method. + + ]]> + + The value of the current object cannot be parsed. + The value of the current object is a number less than or than greater. + + + + + + + Method + + System.Runtime + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.Double + + + + + + An object that provides culture-specific formatting information. + For a description of this member, see . + The converted value of the current object. + + instance is cast to an interface. The recommended alternative is to call the method. + + ]]> + + The value of the current object cannot be parsed. + The value of the current object is a number less than or greater than . + + + + + + + Method + + System.Runtime + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.Int16 + + + + + + An object that provides culture-specific formatting information. + For a description of this member, see . + The converted value of the current object. + + instance is cast to an interface. The recommended alternative is to call the method. + + ]]> + + The value of the current object cannot be parsed. + The value of the current object is a number greater than or less than . + + + + + + + Method + + System.Runtime + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.Int32 + + + + + + An object that provides culture-specific formatting information. + For a description of this member, see . + The converted value of the current object. + + instance is cast to an interface. The recommended alternative is to call the method. + + ]]> + + + + + + + + Method + + System.Runtime + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.Int64 + + + + + + An object that provides culture-specific formatting information. + For a description of this member, see . + The converted value of the current object. + + instance is cast to an interface. The recommended alternative is to call the method. + + ]]> + + + + + + + + Method + + System.Runtime + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.SByte + + + + + + An object that provides culture-specific formatting information. + For a description of this member, see . + The converted value of the current object. + + instance is cast to an interface. The recommended alternative is to call the method. + + ]]> + + The value of the current object cannot be parsed. + The value of the current object is a number greater than or less than . + + + + + + + Method + + System.Runtime + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.Single + + + + + + An object that provides culture-specific formatting information. + For a description of this member, see . + The converted value of the current object. + + instance is cast to an interface. The recommended alternative is to call the method. + + ]]> + + + + + + + + Method + + System.Runtime + 4.0.20.0 + 4.1.0.0 + + + System.String + + + + + + To be added. + To be added. + To be added. + To be added. + + + + + + + Method + + System.Runtime + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.Object + + + + + + + The type of the returned object. + An object that provides culture-specific formatting information. + For a description of this member, see . + The converted value of the current object. + + instance is cast to an interface. The recommended alternative is to call the method. + + ]]> + + + is . + The value of the current object cannot be converted to the type specified by the parameter. + + + + + + + Method + + System.Runtime + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.UInt16 + + + + + + An object that provides culture-specific formatting information. + For a description of this member, see . + The converted value of the current object. + + instance is cast to an interface. The recommended alternative is to call the method. + + ]]> + + The value of the current object cannot be parsed. + The value of the current object is a number greater than or less than . + + + + + + + Method + + System.Runtime + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.UInt32 + + + + + + An object that provides culture-specific formatting information. + For a description of this member, see . + The converted value of the current object. + + instance is cast to an interface. The recommended alternative is to call the method. + + ]]> + + The value of the current object cannot be parsed. + The value of the current object is a number greater or less than + + + + + + + Method + + System.Runtime + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.UInt64 + + + + + + An object that provides culture-specific formatting information. + For a description of this member, see . + The converted value of the current object. + + instance is cast to an interface. The recommended alternative is to call the method. + + ]]> + + + + + + + + Method + + System.Runtime + 4.0.0.0 + 4.0.10.0 + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + + System.Security.SecuritySafeCritical + + + + System.Char[] + + + + Copies the characters in this instance to a Unicode character array. + A Unicode character array whose elements are the individual characters of this instance. If this instance is an empty string, the returned array is empty and has a zero length. + + object) in a string to a character array. The first character copied is at index zero of the returned character array; the last character copied is at index – 1. + + To create a string from the characters in a character array, call the constructor. + + To create a byte array that contains the encoded characters in a string, instantiate the appropriate object and call its method. Some of the standard encodings available in the .NET Framework include the following: + +|Encoding|Object| +|--------------|------------| +|ASCII|| +|UTF-7|| +|UTF-8|| +|UTF-16|| +|UTF-32|| + + For more information, see [Character Encoding in the .NET Framework](~/docs/standard/base-types/character-encoding.md). + + + +## Examples + The following example calls the method to extract the characters in a string to a character array. It then displays the original string and the elements in the array. + + [!code-csharp[System.String.ToCharArray#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.string.tochararray/cs/ToCharArray1.cs#1)] + [!code-vb[System.String.ToCharArray#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.string.tochararray/vb/ToCharArray1.vb#1)] + + The following example defines a string containing the characters that serve as delimiters in a delimited string. It then calls the method to create a character array that can be passed to the method to separate the delimited string into its individual substrings. + + [!code-cpp[StringSplit2#1](~/samples/snippets/cpp/VS_Snippets_CLR/StringSplit2/CPP/stringsplit2.cpp#1)] + [!code-csharp[StringSplit2#1](~/samples/snippets/csharp/VS_Snippets_CLR/StringSplit2/CS/stringsplit2.cs#1)] + [!code-vb[StringSplit2#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/StringSplit2/VB/stringsplit2.vb#1)] + + ]]> + + + + + + + + Method + + System.Runtime + 4.0.0.0 + 4.0.10.0 + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + + System.Security.SecuritySafeCritical + + + + System.Char[] + + + + + + + The starting position of a substring in this instance. + The length of the substring in this instance. + Copies the characters in a specified substring in this instance to a Unicode character array. + A Unicode character array whose elements are the number of characters in this instance starting from character position . + + constructor. + + The `startIndex` parameter is zero-based. That is, the index of the first character in the string instance is zero. + + If `length` is zero, the returned array is empty and has a zero length. If this instance is `null` or an empty string (""), the returned array is empty and has a zero length. + + To create a byte array that contains the encoded characters in a portion of a string, instantiate the appropriate object and call its method. Some of the standard encodings available in the .NET Framework include the following: + +|Encoding|Object| +|--------------|------------| +|ASCII|| +|UTF-7|| +|UTF-8|| +|UTF-16|| +|UTF-32|| + + For more information, see [Character Encoding in the .NET Framework](~/docs/standard/base-types/character-encoding.md). + + + +## Examples + The following example converts a substring within a string to an array of characters, then enumerates and displays the elements of the array. + + [!code-cpp[string.tochararray1#1](~/samples/snippets/cpp/VS_Snippets_CLR/string.ToCharArray1/CPP/tocharry1.cpp#1)] + [!code-csharp[string.tochararray1#1](~/samples/snippets/csharp/VS_Snippets_CLR/string.ToCharArray1/CS/tocharry1.cs#1)] + [!code-vb[string.tochararray1#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/string.ToCharArray1/VB/tocharry1.vb#1)] + + ]]> + + + or is less than zero. + + -or- + + plus is greater than the length of this instance. + + + + + + + Method + + System.Runtime + 4.0.0.0 + 4.0.10.0 + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.String + + + + Returns a copy of this string converted to lowercase. + A string in lowercase. + + [!NOTE] +> This method does not modify the value of the current instance. Instead, it returns a new string in which all characters in the current instance are converted to lowercase. + +## Security Considerations + The casing operation that results from calling the method takes the casing conventions of the current culture into account. If you need the lowercase or uppercase version of an operating system identifier, such as a file name, named pipe, or registry key, use the or methods. This produces the same result in every culture (unlike the method) and performs more efficiently. + + + +## Examples + The following example converts several mixed case strings to lowercase. + + [!code-cpp[stringlowerupper#1](~/samples/snippets/cpp/VS_Snippets_CLR/stringlowerupper/CPP/stringtolower.cpp#1)] + [!code-csharp[stringlowerupper#1](~/samples/snippets/csharp/VS_Snippets_CLR/stringlowerupper/CS/stringtolower.cs#1)] + [!code-vb[stringlowerupper#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/stringlowerupper/VB/stringtolower.vb#1)] + + ]]> + + + As explained in [Best Practices for Using Strings](~/docs/standard/base-types/best-practices-strings.md), we recommend that you avoid calling string casing methods that substitute default values and instead call methods that require parameters to be explicitly specified. To convert a character to lowercase by using the casing conventions of the current culture, call the method overload with a value of for its parameter. + + + + + + + + Method + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.Runtime + 4.2.0.0 + + + System.String + + + + + + An object that supplies culture-specific casing rules. + Returns a copy of this string converted to lowercase, using the casing rules of the specified culture. + The lowercase equivalent of the current string. + + [!NOTE] +> This method does not modify the value of the current instance. Instead, it returns a new string in which all characters in the current instance are converted to lowercase. + +## Security Considerations + If you pass the method a object other than , the casing operation will take culture-specific rules into account. If you need the lowercase or uppercase version of an operating system identifier, such as a file name, named pipe, or registry key, use the or method. This produces the same result in every culture and performs more efficiently. + + + +## Examples + The following example converts two strings of uppercase characters to lowercase characters using the English-United States and Turkish-Turkey cultures, then compares the lowercase strings. The uppercase strings are identical except that for each occurrence of the Unicode LATIN CAPITAL LETTER I in one string, the other string contains LATIN CAPITAL LETTER I WITH DOT ABOVE. + + [!code-cpp[string.tolower1#1](~/samples/snippets/cpp/VS_Snippets_CLR/string.tolower1/CPP/tolower.cpp#1)] + [!code-csharp[string.tolower1#1](~/samples/snippets/csharp/VS_Snippets_CLR/string.tolower1/CS/tolower.cs#1)] + [!code-vb[string.tolower1#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/string.tolower1/VB/tolower.vb#1)] + + ]]> + + + is . + + + + + + + Method + + System.Runtime + 4.0.0.0 + 4.0.10.0 + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.String + + + + Returns a copy of this object converted to lowercase using the casing rules of the invariant culture. + The lowercase equivalent of the current string. + + property. + + If your application depends on the case of a string changing in a predictable way that is unaffected by the current culture, use the method. The method is equivalent to `ToLower(CultureInfo.InvariantCulture)`. The method is recommended when a collection of strings must appear in a predictable order in a user interface control. + +> [!NOTE] +> This method does not modify the value of the current instance. Instead, it returns a new string in which all characters in the current instance are converted to lowercase. + +## Security Considerations + If you need the lowercase or uppercase version of an operating system identifier, such as a file name, named pipe, or registry key, use the or methods. + + + +## Examples + The following example defines a string array that contains a single word in a number of languages. The method is used to populate the elements of a parallel array with the case-insensitive version of each word. The method is used to sort the case-sensitive array based on the order of elements in the lowercase array to ensure that elements appear in the same order regardless of language. + + [!code-csharp[System.String.ToLowerInvariant#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.string.tolowerinvariant/cs/tolowerinvariant.cs#1)] + [!code-vb[System.String.ToLowerInvariant#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.string.tolowerinvariant/vb/tolowerinvariant.vb#1)] + + ]]> + + + + + + + + Method + + System.Runtime + 4.0.0.0 + 4.0.10.0 + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.String + + + + Returns this instance of ; no actual conversion is performed. + The current string. + + method.Note that the example does not explicitly call the method. Instead, the method is called implicitly by the [composite formatting](~/docs/standard/base-types/composite-formatting.md) feature. + + [!code-cpp[string.tostring#1](~/samples/snippets/cpp/VS_Snippets_CLR/string.tostring/CPP/string.tostring.cpp#1)] + [!code-csharp[string.tostring#1](~/samples/snippets/csharp/VS_Snippets_CLR/string.tostring/CS/string.tostring.cs#1)] + [!code-vb[string.tostring#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/string.tostring/VB/string.tostring.vb#1)] + + ]]> + + + + + + + + Method + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.Runtime + 4.2.0.0 + + + System.String + + + + + + (Reserved) An object that supplies culture-specific formatting information. + Returns this instance of ; no actual conversion is performed. + The current string. + + + + + + + + + + Method + + System.Runtime + 4.0.0.0 + 4.0.10.0 + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.String + + + + Returns a copy of this string converted to uppercase. + The uppercase equivalent of the current string. + + [!NOTE] +> This method does not modify the value of the current instance. Instead, it returns a new string in which all characters in the current instance are converted to uppercase. + + The method is often used to convert a string to uppercase so that it can be used in a case-insensitive comparison. A better method to perform case-insensitive comparison is to call a string comparison method that has a parameter whose value you set to for a culture-sensitive, case-insensitive comparison. + +## Security Considerations + The casing operation that results from calling the method takes the casing conventions of the current culture into account. If you need the lowercase or uppercase version of an operating system identifier, such as a file name, named pipe, or registry key, use the or method. This produces the same result in every culture (unlike the method) and performs more efficiently. + + + +## Examples + The following example calls the method to convert a series of one-character strings that contain each character in the Basic Latin, Latin-1 Supplement, and Latin Extended-A character sets. It then displays each string whose uppercase character is different from its lowercase character. + + [!code-cpp[System.String.ToUpper#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.String.ToUpper/cpp/ToUpperEx.cpp#1)] + [!code-csharp[System.String.ToUpper#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.ToUpper/cs/ToUpperEx.cs#1)] + [!code-vb[System.String.ToUpper#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.ToUpper/vb/ToUpperEx.vb#1)] + + ]]> + + + As explained in [Best Practices for Using Strings](~/docs/standard/base-types/best-practices-strings.md), we recommend that you avoid calling string casing methods that substitute default values and instead call methods that require parameters to be explicitly specified. To convert a string to uppercase by using the casing conventions of the current culture, call the method overload with a value of for its parameter. + + + + + + + + Method + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.Runtime + 4.2.0.0 + + + System.String + + + + + + An object that supplies culture-specific casing rules. + Returns a copy of this string converted to uppercase, using the casing rules of the specified culture. + The uppercase equivalent of the current string. + + [!NOTE] +> This method does not modify the value of the current instance. Instead, it returns a new string in which all characters in the current instance are converted to uppercase. + +## Security Considerations + If you pass the method a object other than , the casing operation will take culture-specific rules into account. If you need the lowercase or uppercase version of an operating system identifier, such as a file name, named pipe, or registry key, use the or method. This produces the same result in every culture and performs more efficiently. + + + +## Examples + The following example converts a string of lowercase characters to two strings of uppercase characters using the English-United States and Turkish-Turkey cultures, then compares the uppercase strings. The uppercase strings are identical except that for each occurrence of the Unicode LATIN CAPITAL LETTER I in one string, the other string contains LATIN CAPITAL LETTER I WITH DOT ABOVE. + + [!code-csharp[string.toupper1#1](~/samples/snippets/csharp/VS_Snippets_CLR/string.toupper1/CS/toupper.cs#1)] + [!code-vb[string.toupper1#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/string.toupper1/VB/toupper.vb#1)] + + ]]> + + + is . + + + + + + + Method + + System.Runtime + 4.0.0.0 + 4.0.10.0 + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.String + + + + Returns a copy of this object converted to uppercase using the casing rules of the invariant culture. + The uppercase equivalent of the current string. + + property. + + If your application depends on the case of a string changing in a predictable way that is unaffected by the current culture, use the method. The method is equivalent to `ToUpper(CultureInfo.InvariantCulture)`. The method is recommended when a collection of strings must appear in a predictable order in a user interface control. + +> [!NOTE] +> This method does not modify the value of the current instance. Instead, it returns a new string in which all characters in the current instance are converted to uppercase. + +## Security Considerations + If you need the lowercase or uppercase version of an operating system identifier, such as a file name, named pipe, or registry key, use the or methods. + + + +## Examples + The following example defines a string array that contains a single word in a number of languages. The method is used to populate the elements of a parallel array with the case-insensitive version of each word. The method is used to sort the case-sensitive array based on the order of elements in the uppercase array to ensure that elements appear in the same order regardless of language. + + [!code-csharp[System.String.ToUpperInvariant#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.string.toupperinvariant/cs/toupperinvariant.cs#1)] + [!code-vb[System.String.ToUpperInvariant#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.string.toupperinvariant/vb/toupperinvariant.vb#1)] + + ]]> + + + + + + + + Method + + System.Runtime + 4.0.0.0 + 4.0.10.0 + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.String + + + + Removes all leading and trailing white-space characters from the current object. + The string that remains after all white-space characters are removed from the start and end of the current string. If no characters can be trimmed from the current instance, the method returns the current instance unchanged. + + method removes from the current string all leading and trailing white-space characters. Each leading and trailing trim operation stops when a non-white-space character is encountered. For example, if the current string is " abc xyz ", the method returns "abc xyz". To remove white-space characters between words in a string, use a [.NET Framework Regular Expressions](~/docs/standard/base-types/regular-expressions.md). + +> [!NOTE] +> If the method removes any characters from the current instance, this method does not modify the value of the current instance. Instead, it returns a new string in which all leading and trailing white space characters found in the current instance are removed. + + If the current string equals or all the characters in the current instance consist of white-space characters, the method returns . + + White-space characters are defined by the Unicode standard. The method removes any leading and trailing characters that produce a return value of `true` when they are passed to the method. + + + +## Examples + The following example uses the method to remove any extra white space from strings entered by the user before concatenating them. + + [!code-cpp[System.String.Trim#2](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim2.cpp#2)] + [!code-csharp[System.String.Trim#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Trim/cs/Trim2.cs#2)] + [!code-vb[System.String.Trim#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Trim/vb/Trim2.vb#2)] + + ]]> + + + The [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions maintain an internal list of white-space characters that this method trims. Starting with the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)], the method trims all Unicode white-space characters (that is, characters that produce a return value when they are passed to the method). Because of this change, the method in the [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions removes two characters, ZERO WIDTH SPACE (U+200B) and ZERO WIDTH NO-BREAK SPACE (U+FEFF), that the method in the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)]and later versions does not remove. In addition, the method in the [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions does not trim three Unicode white-space characters: MONGOLIAN VOWEL SEPARATOR (U+180E), NARROW NO-BREAK SPACE (U+202F), and MEDIUM MATHEMATICAL SPACE (U+205F). + + + + + + + + Method + + System.Runtime + 4.2.0.0 + + + System.String + + + + + + To be added. + To be added. + To be added. + To be added. + + + + + + + Method + + System.Runtime + 4.0.0.0 + 4.0.10.0 + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.String + + + + + + System.ParamArray + + + + + + An array of Unicode characters to remove, or . + Removes all leading and trailing occurrences of a set of characters specified in an array from the current object. + The string that remains after all occurrences of the characters in the parameter are removed from the start and end of the current string. If is or an empty array, white-space characters are removed instead. If no characters can be trimmed from the current instance, the method returns the current instance unchanged. + + method removes from the current string all leading and trailing characters that are in the `trimChars` parameter. Each leading and trailing trim operation stops when a character that is not in `trimChars` is encountered. For example, if the current string is "123abc456xyz789" and `trimChars` contains the digits from "1" through "9", the method returns "abc456xyz". + +> [!NOTE] +> If the method removes any characters from the current instance, this method does not modify the value of the current instance. Instead, it returns a new string in which all leading and trailing `trimChars` characters found in the current instance are removed. + + If the current string equals or all the characters in the current instance consist of characters in the `trimChars` array, the method returns . + + If `trimChars` is `null` or an empty array, this method removes any leading or trailing characters that result in the method returning `true` when they are passed to the method, + + + +## Examples + The following example uses the method to remove space, asterisk (*), and apostrophe (') characters from a string. + + [!code-cpp[System.String.Trim#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim1.cpp#1)] + [!code-csharp[System.String.Trim#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.Trim/cs/Trim1.cs#1)] + [!code-vb[System.String.Trim#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.Trim/vb/Trim1.vb#1)] + + ]]> + + + The [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions maintains an internal list of white-space characters that this method trims if is or an empty array. Starting with the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)], if is or an empty array, the method trims all Unicode white-space characters (that is, characters that produce a return value when they are passed to the method). Because of this change, the method in the [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions removes two characters, ZERO WIDTH SPACE (U+200B) and ZERO WIDTH NO-BREAK SPACE (U+FEFF), that the method in the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)]and later versions does not remove. In addition, the method in the [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions does not trim three Unicode white-space characters: MONGOLIAN VOWEL SEPARATOR (U+180E), NARROW NO-BREAK SPACE (U+202F), and MEDIUM MATHEMATICAL SPACE (U+205F). + + + + + + + + Method + + System.Runtime + 4.2.0.0 + + + System.String + + + + To be added. + To be added. + To be added. + + + + + + + Method + + System.Runtime + 4.2.0.0 + + + System.String + + + + + + To be added. + To be added. + To be added. + To be added. + + + + + + + Method + + System.Runtime + 4.0.0.0 + 4.0.10.0 + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.String + + + + + + System.ParamArray + + + + + + An array of Unicode characters to remove, or . + Removes all trailing occurrences of a set of characters specified in an array from the current object. + The string that remains after all occurrences of the characters in the parameter are removed from the end of the current string. If is or an empty array, Unicode white-space characters are removed instead. If no characters can be trimmed from the current instance, the method returns the current instance unchanged. + + method removes from the current string all trailing characters that are in the `trimChars` parameter. The trim operation stops when the first character that is not in `trimChars` is encountered at the end of the string. For example, if the current string is "123abc456xyz789" and `trimChars` contains the digits from "1" through "9", the method returns "123abc456xyz". + +> [!NOTE] +> If the method removes any characters from the current instance, this method does not modify the value of the current instance. Instead, it returns a new string in which all trailing characters found in `trimChars` are removed from the current string. + + + +## Examples + The following example demonstrates how you can use the method to trim white space or punctuation marks from the end of a string. + + [!code-csharp[System.String.TrimEnd#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.TrimEnd/cs/sample2.cs#2)] + [!code-vb[System.String.TrimEnd#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.TrimEnd/vb/Sample2.vb#2)] + + ]]> + + + The [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions maintains an internal list of white-space characters that this method trims if is or an empty array. Starting with the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)], if is or an empty array, the method trims all Unicode white-space characters (that is, characters that produce a return value when they are passed to the method). Because of this change, the method in the [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions removes two characters, ZERO WIDTH SPACE (U+200B) and ZERO WIDTH NO-BREAK SPACE (U+FEFF), that the method in the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)] and later versions does not remove. In addition, the method in the [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions does not trim three Unicode white-space characters: MONGOLIAN VOWEL SEPARATOR (U+180E), NARROW NO-BREAK SPACE (U+202F), and MEDIUM MATHEMATICAL SPACE (U+205F). + + + + + + + + Method + + System.Runtime + 4.2.0.0 + + + System.String + + + + To be added. + To be added. + To be added. + + + + + + + Method + + System.Runtime + 4.2.0.0 + + + System.String + + + + + + To be added. + To be added. + To be added. + To be added. + + + + + + + Method + + System.Runtime + 4.0.0.0 + 4.0.10.0 + 4.0.20.0 + 4.1.0.0 + 4.2.0.0 + + + mscorlib + 2.0.5.0 + 4.0.0.0 + + + netstandard + 2.0.0.0 + + + System.String + + + + + + System.ParamArray + + + + + + An array of Unicode characters to remove, or . + Removes all leading occurrences of a set of characters specified in an array from the current object. + The string that remains after all occurrences of characters in the parameter are removed from the start of the current string. If is or an empty array, white-space characters are removed instead. + + method removes from the current string all leading characters that are in the `trimChars` parameter. The trim operation stops when a character that is not in `trimChars` is encountered. For example, if the current string is "123abc456xyz789" and `trimChars` contains the digits from "1" through "9", the method returns "abc456xyz789". + +> [!NOTE] +> If the method removes any characters from the current instance, this method does not modify the value of the current instance. Instead, it returns a new string in which all leading white space characters found in the current instance are removed. + + + +## Examples + The following example uses the method to trim white space and comment characters from lines of source code. The `StripComments` method wraps a call to and passes it a character array that contains a space and the comment character, which is an apostrophe ( ' ) in Visual Basic and a slash ( / ) in C#. The method is also called to remove leading white space when evaluating whether a string is a comment. + + [!code-csharp[System.String.TrimStart#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.TrimStart/cs/sample.cs#1)] + [!code-vb[System.String.TrimStart#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.TrimStart/vb/sample.vb#1)] + + The following example then illustrates a call to the `StripComments` method. + + [!code-csharp[System.String.TrimStart#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.String.TrimStart/cs/sample.cs#2)] + [!code-vb[System.String.TrimStart#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.String.TrimStart/vb/sample.vb#2)] + + ]]> + + + The [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions maintains an internal list of white-space characters that this method trims if is or an empty array. Starting with the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)], if is or an empty array, the method trims all Unicode white-space characters (that is, characters that produce a return value when they are passed to the method). Because of this change, the method in the [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions removes two characters, ZERO WIDTH SPACE (U+200B) and ZERO WIDTH NO-BREAK SPACE (U+FEFF), that the method in the [!INCLUDE[net_v40_short](~/includes/net-v40-short-md.md)] and later versions does not remove. In addition, the method in the [!INCLUDE[net_v35SP1_short](~/includes/net-v35sp1-short-md.md)] and earlier versions does not trim three Unicode white-space characters: MONGOLIAN VOWEL SEPARATOR (U+180E), NARROW NO-BREAK SPACE (U+202F), and MEDIUM MATHEMATICAL SPACE (U+205F). + + + + +