How to remove a suffix from end of string?

String.Substring can do that:

column = column.Substring(0, column.Length - 2);

You can use it to roll your own RemoveFromEnd:

public static string RemoveFromEnd(this string s, string suffix)
{
    if (s.EndsWith(suffix))
    {
        return s.Substring(0, s.Length - suffix.Length);
    }

    return s;
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)