Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions docs/csharp/how-to/parse-strings-using-split.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Divide strings using String.Split"
description: The Split method returns an array of strings split from a set of delimiters. It's an easy way to extract substrings from a string.
ms.date: 02/18/2025
ms.date: 12/05/2025
helpviewer_keywords:
- "splitting strings [C#]"
- "Split method [C#]"
Expand Down Expand Up @@ -85,12 +85,14 @@ You can use AI tools, such as GitHub Copilot, to generate code to split strings
The following text shows an example prompt for Copilot Chat:

```copilot-prompt
Generate C# code to use Split.String to split a string into substrings.
Input string is "You win some. You lose some." Delimiters are space and period.
Provide example output.
Generate C# code to split a CSV-style input string containing values, where entries may be separated by commas or semicolons and may contain extra whitespace.
Remove any empty values and trim whitespace from the results.
Show example output for the string: " apples, oranges ; bananas, , ;pears".
Comment on lines +88 to +90
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an opinion, but I like the earlier example better, possibly to split a paragraph into distinct sentences using sentence ending punctuation for delimiters: ., ?, and !, and trimming additional whitespace.

```

GitHub Copilot is powered by AI, so surprises and mistakes are possible. For more information, see [Copilot FAQs](https://aka.ms/copilot-general-use-faqs).
Review Copilot's suggestions before applying them.

For more information, see [Copilot FAQs](https://aka.ms/copilot-general-use-faqs).

## See also

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ The following example calls the <xref:System.Convert.ToInt32%28System.String%29?

You can use AI tools, such as GitHub Copilot, to generate C# code to convert a string to a number. You can customize the prompt to use a string per your requirements.

The following text shows an example prompt for Copilot Chat:
Here's an example Copilot Chat prompt:

```copilot-prompt
Show me how to parse a string as a number, but don't throw an exception if the input string doesn't represent a number.
```

GitHub Copilot is powered by AI, so surprises and mistakes are possible. For more information, see [Copilot FAQs](https://aka.ms/copilot-general-use-faqs).
Review Copilot's suggestions before applying them.

For more information, see [Copilot FAQs](https://aka.ms/copilot-general-use-faqs).

## See also

Expand Down