-1

my array contains string like this :

eth1
eth12
eth20
eth35
eth5

I want another array who contains only the number of these string :

1
12
20
35
5

I tried with Trimend() function, but i don't know how to specify this...

thanks for your help

4

1 回答 1

3

这是一种方式

$mynewarray = $myarray  -replace 'eth' 

如果文本并不总是“eth”

$mynewarray = $myarray -replace '\D' 
于 2013-07-18T09:59:51.750 回答