|
1 | 1 |
|
2 | 2 |
|
3 |
| -In this exercise, you'll use the `IndexOf()` method to locate the position of one character or string inside a larger string. |
4 | 3 |
|
5 |
| -You'll begin by accessing parts of a string by identifying the position of one or more characters. Once you've located the position, you can then extract a specific part of the string. |
| 4 | +In this exercise, you use the `IndexOf()` method to locate the position of one or more characters string inside a larger string. You use the `Substring()` method to return the part of the larger string that follows the character positions you specify. |
6 | 5 |
|
7 |
| -Once you've located the position, you can use the `Substring()` method to return the rest of the string after the position. |
8 |
| - |
9 |
| -You could also use an overloaded version of the `Substring()` method to set the length of characters to return after the position. |
| 6 | +You'll also use an overloaded version of the `Substring()` method to set the length of characters to return after a specified position in a string. |
10 | 7 |
|
11 | 8 | ### Prepare your coding environment
|
12 | 9 |
|
13 |
| -This module includes hands-on activities that guide you through the process of building and running demonstration code. You're encouraged to complete these activities using Visual Studio Code as your development environment. Using Visual Studio Code for these activities will help you to become more comfortable writing and running code in a developer environment that's used by professionals worldwide. |
| 10 | +This module includes hands-on activities that guide you through the process of building and running demonstration code. You're encouraged to complete these activities using Visual Studio Code as your development environment. Using Visual Studio Code for these activities help you to become more comfortable writing and running code in a developer environment that's used by professionals worldwide. |
14 | 11 |
|
15 | 12 | > [!NOTE]
|
16 | 13 | > If you have completed other Microsoft Learn modules in this C# series, you may have already created a project folder for code samples. If that's the case, you can skip the following section of steps, and delete the code in the `Project.cs` file used for a previous exercise.
|
@@ -49,7 +46,7 @@ This module includes hands-on activities that guide you through the process of b
|
49 | 46 |
|
50 | 47 | 1. Delete the existing code lines.
|
51 | 48 |
|
52 |
| - You'll be using this C# console project to create, build, and run code samples during this module. |
| 49 | + You are using this C# console project to create, build, and run code samples during this module. |
53 | 50 |
|
54 | 51 | 1. Close the Terminal panel.
|
55 | 52 |
|
@@ -121,7 +118,7 @@ This module includes hands-on activities that guide you through the process of b
|
121 | 118 |
|
122 | 119 | The `Substring()` method needs the starting position and the number of characters, or length, to retrieve. So, you calculate the length in a temporary variable called `length`, and pass it with the `openingPosition` value to retrieve the string inside of the parenthesis.
|
123 | 120 |
|
124 |
| - The result is close, however the output includes the opening parenthesis. In this exercise, the inclusion of the parenthesis isn't desired. To remove the parenthesis from output, you'll have to update the code to skip the index of the parenthesis itself. |
| 121 | + The result is close, however the output includes the opening parenthesis. In this exercise, the inclusion of the parenthesis isn't desired. To remove the parenthesis from output, you have to update the code to skip the index of the parenthesis itself. |
125 | 122 |
|
126 | 123 | ### Modify the starting position of the sub string
|
127 | 124 |
|
@@ -200,7 +197,7 @@ Hardcoded strings like `"<span>"` in the previous code listing are known as "mag
|
200 | 197 |
|
201 | 198 | The code uses a constant with the `const` keyword. A constant allows you to define and initialize a variable whose value can never be changed. You would then use that constant in the rest of the code whenever you needed that value. This ensures that the value is only defined once and misspelling the `const` variable will be caught by the compiler.
|
202 | 199 |
|
203 |
| - The pervious code listing is a safer way to write the same code you examined in the previous section. Now, if the value of `openSpan` changes to `<div>`, the line of code that uses the `Length` property will continue to be valid. |
| 200 | + The pervious code listing is a safer way to write the same code you examined in the previous section. Now, if the value of `openSpan` changes to `<div>`, the line of code that uses the `Length` property continues to be valid. |
204 | 201 |
|
205 | 202 | ## Recap
|
206 | 203 |
|
|
0 commit comments