Asked By
Nabil
0 points
N/A
Posted on - 06/29/2016
Can I use Power Shell convert string to number? I am facing problems while converting a string to an integer. How can I convert a string value to the number using Power Shell Prompt? Give me an example to help me understand better.
Answered By
Habeeb
0 points
N/A
#112408
Getting Started With PowerShell Convert String To Number
Let me explain this with an example, suppose you want to convert 2.3 to 23, try this simple method:
[string]$strNum = "2.3"
[int]$intNum = [convert]::ToInt32($strNum, 10)
$intNum
Here the string is first converted to the int32 and I have used the base number as 10 to convert decimal number into the binary one.