How to remove the first N characters from a string in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main()
    {
        string str = "abcdefghijklmnop";
        int N = 7;

        // Slice the string by taking a substring starting from index N
        str = str.Substring(N);

        Console.WriteLine(str);
    }
}



/*
run:

hijklmnop

*/

 



answered Apr 23, 2025 by avibootz
...