2013-06-10 11 views
29

Ben noktalı virgül ile ayrılmış e-posta adresleri bir dize var?

[string[]]$recipients = "[email protected]", "[email protected]", "[email protected]" 
+1

Olası çoğaltması [PowerShell ile bölünmüş dize ve her belirteci ile bir şeyler yapın] (http://stackoverflow.com/questions/11348506/split-string-with-powershell-and-do-something-with-each-token –

cevap

47

: Sağ taraftaki aslında bir harf duyarsız, regular expression değil, basit bir maç olduğunu

$recipients = $addresses -split "; " 

Not. Büyük/küçük harf duyarlılığı zorlamak için csplit kullanın. Daha fazla ayrıntı için bkz. about_Split.

+0

+1, bölünmüş operatörü denemedim –

10
[string[]]$recipients = $address.Split('; ',[System.StringSplitOptions]::RemoveEmptyEntries) 
+0

Teşekkürler! Bu benim için çalıştı :) .replace için – user952342

İlgili konular