-
Notifications
You must be signed in to change notification settings - Fork 6k
Update parse strings with split #4083
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update parse strings with split #4083
Conversation
Ready for a proofread after the build.
Ooops. They must not be in the gitignore file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left a number of comments, but this looks good, @BillWagner; the C# REPL really helps here.
|
||
The <xref:System.String.Split%2A?displayProperty=nameWithType> method creates an | ||
array of substrings by splitting the input string based on one or more delimiters. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: There's no need for a paragraph break here.
|
||
[!code-csharp-interactive[split strings on word boundaries](../../../samples/snippets/csharp/how-to/strings/ParseStringsUsingSplit.cs#1)] | ||
|
||
Every instance of one of the separator characters produces a value in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's only one separator character in the previous and the next example, though. Perhaps rephrase this to "Every instance of a separator character produces..."
|
||
Every instance of one of the separator characters produces a value in the | ||
returned array. Consecutive separator characters produce the empty string | ||
as a value in the returned array. You can see this in the following example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
possibly append an explanation of the separator character here: "You can see this in the following example, which uses a space as the separator character."
|
||
[!code-csharp-interactive[split strings with repeated separators](../../../samples/snippets/csharp/how-to/strings/ParseStringsUsingSplit.cs#2)] | ||
|
||
This behvior makes it easier for formats like comma separated values (CSV) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
behvior --> behavior
This behvior makes it easier for formats like comma separated values (CSV) | ||
files representing tabular data. Consecutive commas represent a blank column. | ||
|
||
You can pass an optional <xref:System.StringSplitOptions.RemoveEmptyEntries> parameter to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typically, enum members used ?displayProperty=fullName.
files representing tabular data. Consecutive commas represent a blank column. | ||
|
||
You can pass an optional <xref:System.StringSplitOptions.RemoveEmptyEntries> parameter to | ||
exclude any empty strings in the output. For more complicated processing of the returned |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than output, which connotes I/O, "returned array" would be better.
the result sequence. | ||
|
||
<xref:System.String.Split%2A?displayProperty=nameWithType> can use | ||
multiple separator characters. The following example uses spaces, commas, periods, colons, and tabs, all passed in an array containing these separating characters to <xref:System.String.Split%2A>. Each word in the target string's sentence displays separately from the resulting array of strings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comma after "separating characters"
I'm not quite sure what the last sentence means.
I addressed all your comments @rpetrusha This is ready to go again. |
This looks good, @BillWagner. I'll merge now. |
Fixes #3330
Update samples based on common questions, make samples interactive, and update links.
The referenced sample is now linked in the topic as well.
Internal review link