Skip to content

Commit 605e69d

Browse files
authored
Revise AI prompt example (#50355)
* Revise date and enhance Copilot prompt example Updated the date and modified the Copilot prompt example to include CSV-style input handling. * Updates * Refine Copilot prompt for CSV string parsing Updated prompt to clarify parsing requirements for CSV-style data.
1 parent 1536707 commit 605e69d

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

docs/csharp/how-to/parse-strings-using-split.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Divide strings using String.Split"
33
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.
4-
ms.date: 02/18/2025
4+
ms.date: 12/05/2025
55
helpviewer_keywords:
66
- "splitting strings [C#]"
77
- "Split method [C#]"
@@ -83,12 +83,16 @@ You can use AI tools, such as GitHub Copilot, to generate code to split strings
8383
The following text shows an example prompt for Copilot Chat:
8484

8585
```copilot-prompt
86-
Generate C# code to use Split.String to split a string into substrings.
87-
Input string is "You win some. You lose some." Delimiters are space and period.
88-
Provide example output.
86+
Generate C# code to parse and split CSV-style data from user input or external export that isn't well formed.
87+
The input string may contain mixed delimiters (commas, semicolons), inconsistent spacing and empty entries.
88+
Parse the string: accept all valid separators, remove any empty values and trim whitespace from all entries.
89+
Return a clean list of values.
90+
Show example output for the string: " apples, oranges ; bananas, , ;pears".
8991
```
9092

91-
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).
93+
Review Copilot's suggestions before applying them.
94+
95+
For more information, see [Copilot FAQs](https://aka.ms/copilot-general-use-faqs).
9296

9397
## See also
9498

docs/csharp/programming-guide/types/how-to-convert-a-string-to-a-number.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,15 @@ The following example calls the <xref:System.Convert.ToInt32%28System.String%29?
5959

6060
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.
6161

62-
The following text shows an example prompt for Copilot Chat:
62+
Here's an example Copilot Chat prompt:
6363

6464
```copilot-prompt
6565
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.
6666
```
6767

68-
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).
68+
Review Copilot's suggestions before applying them.
69+
70+
For more information, see [Copilot FAQs](https://aka.ms/copilot-general-use-faqs).
6971

7072
## See also
7173

0 commit comments

Comments
 (0)