UTF-16 safe substring in C# .NET

2020-08-10 09:37发布

问题:

I want to get a substring of a given length say 150. However, I want to make sure I don't cut off the string in between a unicode character.

e.g. see the following code:

var str = "Hello