Most string operations aren't safe

I have been doing common string operations incorrectly for most of my career, and I suspect you have too. Take this truncation function: public static string Truncate ( string value , int maxLength ) { return value . Length > maxLength ? value . Substring ( 0 , maxLength ) : value ; } Looks fine. Here&rsquo;s what it does with a string containing an emoji: var hello = "hello! 👋 nice to meet you"…