feat: add method to convert user text into character array
Add new userTextToAnArray method that converts a string into an array of individual characters using LINQ Select and ToArray. This allows for character-level processing of user input. Also add System.Linq using statement to support LINQ operations.
This commit is contained in:
1 file changed
+8
@@ -8,6 +8,7 @@
|
|||||||
/// └─────────────────────────────────────────────────────────────────────────────────────────┘
|
/// └─────────────────────────────────────────────────────────────────────────────────────────┘
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
class PI114
|
class PI114
|
||||||
{
|
{
|
||||||
@@ -96,5 +97,12 @@ class PI114
|
|||||||
string userText = Console.ReadLine();
|
string userText = Console.ReadLine();
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
Console.WriteLine(userText);
|
Console.WriteLine(userText);
|
||||||
|
userTextToAnArray(userText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void userTextToAnArray(string userText)
|
||||||
|
{
|
||||||
|
string[] userTextArray = userText.Select(x => x.ToString()).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user