Definition: Returns the integer portion of a number.


Friends, are you plagued by decimal points? Would you just as soon strip off those pesky little decimal values and leave yourself with a clean, pure integer value? Then have we got a deal for you. In Windows PowerShell you can remove decimal places by using the System.Mathclass and the Truncate method. For example, here we assign the value 11.98 to $a, then use Truncate to remove the .98:


$a = 11.98
$a = [math]: :truncate($a)


When you run this command and then echo back the value of $ a youshould get the following:




Note. Keep in mind that the truncate method simply removes all numbers following the decimal point; it does not round values to the nearest whole number. If you want to do that, use the Roundmethod instead.