【发布时间】:2014-12-16 21:05:23
【问题描述】:
我正在使用一个子字符串,它将在第二个 '.' 之前给我所有的东西。我之前使用过子字符串来获取第一个 '.' 之前的所有内容。
$id = $file.Substring(0, $File.LastIndexof('.'))
而且效果很好。对于第二个子字符串,这是我迄今为止所拥有的
$netVerShort = $netVer.Substring(0, 2nd ('.'))
但我确定这是不对的。我从 $netVer 得到的值是 2.0.5727 并且使用第二个子字符串我试图让它返回 2.0
【问题讨论】:
-
这个问题和你的previous one有什么不同?
标签: powershell substring