【发布时间】:2014-10-12 13:04:09
【问题描述】:
我有一个字符串,我想分成两部分。第一段在逗号之前(,),第二段在逗号之后(包括逗号)。
我已经设法检索到变量$Header 中逗号之前的第一段,但我不知道如何检索一个大字符串中第一个comma 之后的段。
$string = "Header text,Text 1,Text 2,Text 3,Text 4,"
$header = $string.Split(',')[0] # $Header = "Header text"
$content = "Text 1,Text 2,Text 3,Text 4,"
# There might be more text then visible here, like say Text 5, Text 6, ..
【问题讨论】:
标签: string powershell split