internal static string CutTrailing(string whole, string cutoff) { try { return whole.Substring(0, whole.IndexOf(cutoff)); } catch (ArgumentOutOfRangeException) { return ERR_CONST; } }