$string = "[email protected]"
$string.Substring(0,$string.IndexOf("@"))
Uses a substring and IndexOf to break apart the string
PS C:\> $string = "[email protected]" >> $string.Substring(0,$string.IndexOf("@")) john.doe
$string = "[email protected]"
$string.Substring(0,$string.IndexOf("@"))
DetailsPS C:\> $string = "[email protected]" >> $string.Substring(0,$string.IndexOf("@")) john.doe