Joel Bennett on Nostr: I've been playing with strings in #dotnet and #PowerShell trying to determine how ...
I've been playing with strings in #dotnet and #PowerShell trying to determine how long strings are (or appear to be), in a terminal.
As an exercise, I tried to make Windows PowerShell compatible version of Measure-String that:
1. Properly ignores ANSI escape sequences (better than current $Host.UI.RawUI.LengthInBufferCells)
2. Properly account for UAX29 (e.g. the 19-char long 👨🏻👩🏼👧🏼👧🏼 emoji)
#ProTip: it's not worth it to try and do _ANYTHING_ in Unicode in .NET Framework 4.x
As an exercise, I tried to make Windows PowerShell compatible version of Measure-String that:
1. Properly ignores ANSI escape sequences (better than current $Host.UI.RawUI.LengthInBufferCells)
2. Properly account for UAX29 (e.g. the 19-char long 👨🏻👩🏼👧🏼👧🏼 emoji)
#ProTip: it's not worth it to try and do _ANYTHING_ in Unicode in .NET Framework 4.x