Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

Entries from 2017-04-13 to 1 day

How to convert from a code point (U+xxxx) to a character

function ConvertFrom-CodePoint { Param( [Parameter(ValueFromPipeline=$true,Mandatory=$true)] [string] $CodePoint, [Parameter(ValueFromPipeline=$false,Mandatory=$true)] $From ) begin { [System.Text.Encoding]::RegisterProvider([System.Text.C…

You can't use > in comparation (and it will be silently failed)

In PowerShell, you have to use -lt and -gt, instead of < and > in comparation, like POSIX sh. Especially if you wrongly use > like below, the comparison will be silently failed (evaluated as $false) and value of left-hand operand is wrote …