本文介绍了如何分割字符串内容转换成PowerShell中的字符串数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有了电子邮件由分号分隔字符串
$地址=foo@bar.com; boo@bar.com; zoo@bar.com
我怎么能分裂成字符串数组,这将导致该为:
[字符串[]] $收件人=foo@bar.com,boo@bar.com,zoo@bar.com
解决方案
由于PowerShell的2,简单: $收件人= $地址-split;
I have a string that has emails separated by semi-colon
$address = "foo@bar.com; boo@bar.com; zoo@bar.com"
How can I split this into an array of strings that would result as:
[string[]]$recipients = "foo@bar.com", "boo@bar.com", "zoo@bar.com"
解决方案
As of powershell 2, simple:$recipients = $addresses -split "; "
这篇关于如何分割字符串内容转换成PowerShell中的字符串数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!