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

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

40,026 questions

51,982 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 144 views
1 answer 121 views
1 answer 135 views
1 answer 100 views
100 views asked Feb 28, 2023 by avibootz
3 answers 328 views
2 answers 291 views
...