dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.28k stars 5.91k forks source link

Update String.Split conceptual guide with more String.Split overloads #20123

Open Youssef1313 opened 4 years ago

Youssef1313 commented 4 years ago

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.


Associated WorkItem - 226914

BillWagner commented 4 years ago

I like this idea as well @Youssef1313

Would you like to work on it?

gewarren commented 4 years ago

Related to dotnet/dotnet-api-docs#4309.

CamSoper commented 8 months ago

I have added code to illustrate the usage of int32 in String.Split overloads. The code was added in https://github.com/dotnet/docs/pull/39850 but since Try.NET doesn't support it as of this writing, and I think interactivity is a good fit for that page, I'm holding the text I wrote out of the article.

When somebody revisits this issue at some future time, my suggestion is to add the following markdown just before the ## See Also:

Some overloads of the <xref:System.String.Split%2A?displayProperty=nameWithType> method allow you to limit the number of substrings returned in the array. This example limits the number of substrings to four, so it returns the first three words as the first three elements of the array, and the rest of the string as the fourth element.

:::code language="csharp" interactive="try-dotnet-method" source="../../../samples/snippets/csharp/how-to/strings/ParseStringsUsingSplit.cs" id="Snippet6":::