Skip to content

Conversation

BillWagner
Copy link
Member

@BillWagner BillWagner commented Jan 9, 2018

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

Copy link
Contributor

@rpetrusha rpetrusha left a 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.

Copy link
Contributor

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
Copy link
Contributor

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:
Copy link
Contributor

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)
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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.
Copy link
Contributor

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.

@BillWagner
Copy link
Member Author

I addressed all your comments @rpetrusha This is ready to go again.

@rpetrusha
Copy link
Contributor

This looks good, @BillWagner. I'll merge now.

@rpetrusha rpetrusha merged commit ba4ca4c into dotnet:master Jan 16, 2018
@BillWagner BillWagner deleted the update-parse-strings-with-split branch January 22, 2018 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants