Q:

Write a C# Sharp program to remove all "a" in each string in given list of strings and return the new string

0

Write a C# Sharp program to remove all "a" in each string in given list of strings and return the new string

Sample Output:

bc cdef js php

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;
using System.Collections.Generic;
using System.Linq;

namespace exercises
{
   class Program
    {       
        static void Main(string[] args)
        {         
           List<string> mylist = test(new List<string>(new string[] { "abc", "cdaef", "js" , "php" }));                  
           foreach(var i in mylist)
            {
               Console.Write(i.ToString()+" ");
            }     
        }                  
        public static List<string> test(List<string> str)
          {
           return str.Select(x => x.Replace("a", "")).ToList();
          }    
    } 
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now