I have a string of text and I need to check the string for words that begin with the letter A, then print said words to console.
So far, I have converted the string into its individual parts but am not sure how to go about using substring or StartsWith
and an if statement to then feed it to Console.WriteLine
.
This is my code so far.
static void Main(string[] args)
{
string text = "Anna and Jenny went to America to eat some apples";
string[] words = text.Split(' ');
foreach (string word in words)
{
}