counter customizable

PowerShell simple trim after specific character

A example of a simple Trim in PowerShell after a specific character. This will trim after “ –“

 

$Text = "Intel7series-USB3 driver – 1.0.10.255 – 01"
$Text.Substring(0, $Text.IndexOf(‘ -‘))

 

This will return “Intel7series-USB3 driver “

Mikael Karlsson posted at 2015-10-9 Category: PowerShell