Q:

Write a C# program remove specified a character from a non-empty string using index of a character

0

Write a C# program remove specified a character from a non-empty string using index of a character

Test Data: w3resource

Sample Output:

wresource                                                              
w3resourc                                                              
3resource

All Answers

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

using System;
using System.Collections.Generic;

public class Exercise15 {
  static void Main(string[] args)
        {
            Console.WriteLine(remove_char("w3resource", 1));
            Console.WriteLine(remove_char("w3resource", 9));
            Console.WriteLine(remove_char("w3resource", 0));     
        }
       public static string remove_char(string str, int n)
        {
            return str.Remove(n, 1);
        }
}

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