我试图用分隔符吐出字符串,这是一个字符串:
$string = "5637144576, messag<>est<<>>5637145326, 1<<>>5637145328, 0"
$separator = "<<>>"
$string.Split($separator)
作为分裂的结果,我得到:
5637144576, messag
est
5637145326, 1
5637145328, 0
代替
5637144576, messag<>est
5637145326, 1
5637145328, 0
当我尝试使用接受字符串 [] 的重载拆分时:
$string = "5637144576, messag<>est<<>>5637145326, 1<<>>5637145328, 0"
$separator = @("<<>>")
$string.Split($separator)
但我得到下一个错误:
Cannot convert argument "0", with value: "System.Object[]", for "Split" to type "System.Char[]": "Cannot convert value "<<>>" to type "System.Char". Error: "String must be exactly one character long.""
有人知道如何逐个字符串拆分字符串吗?