SyntaxFix
Write A Post
Hire A Developer
Questions
s = s.Substring(0, Math.Max(0, s.Length - 2))
to include the case where the length is less than 2