Converting Binary String to Integer

by May 15, 2017

Here is how you convert a binary text string into the corresponding integer value:

$binary = "110110110"
$int = [Convert]::ToInt32($binary,2)
$int

Going the other way is even easier:

 
PS> [Convert]::ToString(438,2)
110110110 
 

Twitter This Tip! ReTweet this Tip!