Is there a function that will remove the last 4 char of a string? trimend works but i have to specify which chars. what if i dont know what the chars will be. I still need to remove the last 4 chars. any ideas?

HI, Use string.Remove(StartIndex) method.

Ex

string SampleStr = "String Sample1234";
    if (SampleStr.Length > 4)
        SampleStr =SampleStr.Remove(SampleStr.Length - 4);
    MessageBox.Show(SampleStr);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.