You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: xml/System/String.xml
+13-13Lines changed: 13 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -13153,12 +13153,12 @@ The following example defines a `StripStartTags` method that uses the <xref:Syst
13153
13153
<format type="text/markdown"><![CDATA[
13154
13154
13155
13155
## Remarks
13156
-
You call the <xref:System.String.Substring(System.Int32)> 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 the end of the string, call the <xref:System.String.Substring(System.Int32%2CSystem.Int32)> method.
13156
+
You call the <xref:System.String.Substring(System.Int32)> 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 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 the end of the string, call the <xref:System.String.Substring(System.Int32%2CSystem.Int32)> method.
13157
13157
13158
13158
> [!NOTE]
13159
13159
> 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.
13160
13160
13161
-
To extract a substring that begins with a particular character or character sequence, call a method such as <xref:System.String.IndexOf%2A> or <xref:System.String.IndexOf%2A> to get the value of `startIndex`. The second example illustrates this; it extracts a key value that begins one character position after the "=" character.
13161
+
To extract a substring that begins with a particular character or character sequence, call a method such as <xref:System.String.IndexOf%2A> or <xref:System.String.IndexOf%2A> to get the value of `startIndex`. The second example illustrates this; it extracts a key value that begins one character position after the `=` character.
13162
13162
13163
13163
If `startIndex` is equal to zero, the method returns the original string unchanged.
13164
13164
## Examples
@@ -13169,7 +13169,7 @@ The following example defines a `StripStartTags` method that uses the <xref:Syst
@@ -13250,32 +13250,32 @@ The following example defines a `StripStartTags` method that uses the <xref:Syst
13250
13250
<format type="text/markdown"><![CDATA[
13251
13251
13252
13252
## Remarks
13253
-
You call the <xref:System.String.Substring(System.Int32%2CSystem.Int32)> 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 <xref:System.String.Substring(System.Int32)> method.
13253
+
You call the <xref:System.String.Substring(System.Int32%2CSystem.Int32)> 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 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 <xref:System.String.Substring(System.Int32)> method.
13254
13254
13255
13255
> [!NOTE]
13256
13256
> 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.
13257
13257
13258
-
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 <xref:System.String.Substring%2A> method attempts to extract characters from index `startIndex` to index `startIndex` + `length` - 1.
13258
+
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 <xref:System.String.Substring%2A> method attempts to extract characters from index `startIndex` to index `startIndex` + `length` - 1.
13259
13259
13260
-
To extract a substring that begins with a particular character or character sequence, call a method such as <xref:System.String.IndexOf%2A> or <xref:System.String.LastIndexOf%2A> to get the value of `startIndex`.
13260
+
To extract a substring that begins with a particular character or character sequence, call a method such as <xref:System.String.IndexOf%2A> or <xref:System.String.LastIndexOf%2A> to get the value of `startIndex`.
13261
13261
13262
-
If the substring extends from `startIndex` to a specified character sequence, you can call a method such as <xref:System.String.IndexOf%2A> or <xref:System.String.LastIndexOf%2A> 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:
13262
+
If the substring should extend from `startIndex` to a specified character sequence, you can call a method such as <xref:System.String.IndexOf%2A> or <xref:System.String.LastIndexOf%2A> 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:
13263
13263
13264
-
- 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 <xref:System.String.IndexOf%2A> or <xref:System.String.IndexOf%2A> method. The following example extracts a continuous block of "b" characters from a string.
13264
+
- 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 <xref:System.String.IndexOf%2A> or <xref:System.String.LastIndexOf%2A> method. The following example extracts a continuous block of "b" characters from a string.
- 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 <xref:System.String.IndexOf%2A> or <xref:System.String.IndexOf%2A> 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 `<definition>` element.
13270
+
- 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 <xref:System.String.IndexOf%2A> or <xref:System.String.LastIndexOf%2A> 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 `<definition>` element.
- 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 <xref:System.String.IndexOf%2A> or <xref:System.String.IndexOf%2A> method.
13276
+
- 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 <xref:System.String.IndexOf%2A> or <xref:System.String.LastIndexOf%2A> method.
13277
13277
13278
-
If `startIndex` is equal to zero and equals the length of the current string, the method returns the original string unchanged.
13278
+
If `startIndex` is equal to zero and `length` equals the length of the current string, the method returns the original string unchanged.
13279
13279
13280
13280
## Examples
13281
13281
The following example illustrates a simple call to the <xref:System.String.Substring(System.Int32%2CSystem.Int32)> method that extracts two characters from a string starting at the sixth character position (that is, at index five).
@@ -13286,7 +13286,7 @@ The following example defines a `StripStartTags` method that uses the <xref:Syst
13286
13286
13287
13287
The following example uses the <xref:System.String.Substring(System.Int32%2CSystem.Int32)> 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.
13288
13288
13289
-
- 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`.
13289
+
- It extracts the single character at the third position in the string (at index 2) and compares it with a "c". This comparison returns `true`.
13290
13290
13291
13291
- It extracts zero characters starting at the fourth position in the string (at index 3) and passes it to the <xref:System.String.IsNullOrEmpty%2A> method. This returns true because the call to the <xref:System.String.Substring%2A> method returns <xref:System.String.Empty?displayProperty=nameWithType>.
13292
13292
@@ -13296,7 +13296,7 @@ The following example defines a `StripStartTags` method that uses the <xref:Syst
0 commit comments