Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ninmonkey committed May 15, 2024
2 parents 643b44d + aae5d79 commit ec71062
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Pwsh/Unicode/UtilsForUnicodeStrings.psm1
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function UnicodeLength {
# Text.Rune and other features used require Pwsh7+

function UnicodeLength {
<#
.SYNOPSIS
this gives the "length" of a string in terms of codepoints (aka runes)
Expand Down Expand Up @@ -30,6 +32,14 @@ function ShowHex {
# $Input | join-string -f '{0:x}'
}

filter ShowUni {
# sugar. nothing to see here...
($_ ?? '').EnumerateRunes()
| Join-string -f "`n- {0}" -p {
$_.Value.ToString('x'), $_
}
}

$script:Enc8 = [Text.Encoding]::GetEncoding('utf-8')
$script:Enc16 = [Text.Encoding]::GetEncoding('utf-16le')

Expand Down

0 comments on commit ec71062

Please sign in to comment.