Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,104 questions

40,777 answers

573 users

How to remove char from a string by index in C#

1 Answer

0 votes
using System;
using System.Text;

class Program
{
    static string string_char_remove(string s, int idx) { 
        int len = s.Length; 
 
        StringBuilder sb = new StringBuilder(s);
        
        sb.Remove(idx, 1);
        
        return sb.ToString();
    } 
    static void Main() {
        string s = "c# programming"; 
 
        s = string_char_remove(s, 3);

        Console.Write(s);
    }
}




/*
run:

c# rogramming

*/

 





answered Nov 16, 2019 by avibootz

Related questions

1 answer 76 views
1 answer 67 views
1 answer 86 views
1 answer 34 views
2 answers 145 views
...