使用split
运算符时,如:
**********************
PowerShell transcript start
Start time: 20210719105630
Username: gondornicholas
RunAs User: gondornicholas
Configuration Name:
Machine: gondor (Unix 5.8.0.59)
Host Application: /snap/powershell/160/opt/powershell/pwsh.dll
Process ID: 16273
PSVersion: 7.1.3
PSEdition: Core
GitCommitId: 7.1.3
OS: Linux 5.8.0-59-generic #66-Ubuntu SMP Thu Jun 17 00:46:01 UTC 2021
Platform: Unix
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.10032.0, 6.0.0, 6.1.0, 6.2.0, 7.0.0, 7.1.3
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1
WSManStackVersion: 3.0
**********************
Transcript started, output file is strings.txt
PS /home/nicholas/power_shell> $string = "b1i9r8t7h"
PS /home/nicholas/power_shell> $array = $string -split "d"
PS /home/nicholas/power_shell> $array
b
i
r
t
h
PS /home/nicholas/power_shell> $array = $string -split "D"
PS /home/nicholas/power_shell> $array
1
9
8
7
PS /home/nicholas/power_shell> $array = $string.split("D")
PS /home/nicholas/power_shell> $array
b1i9r8t7h
PS /home/nicholas/power_shell> $array = $string.split("d")
PS /home/nicholas/power_shell> $array
b1i9r8t7h
PS /home/nicholas/power_shell> Stop-Transcript
**********************
PowerShell transcript end
End time: 20210719105811
**********************
使用上面的点运算符的结果是什么?它有什么作用吗?没有什么似乎它应该做些什么或返回一个错误。
如何区分函数和运算符
另请参阅:
https://www.sqlshack.com/powershell-split-a-string-into-an-array/
https://learn.microsoft.com/en-us/dotnet/api/system.string.split?view=net-5.0
https://learn.microsoft.com/en-us/dotnet/api/system.text.regularexpressions.regex.split?view=net-5.0
附带说明一下,如何从REPL
控制台访问操作员和功能的帮助文件
帮助文件说:
备注
Regex.Split方法类似于String.Split(Char[](方法,但Regex.Split在分隔符处拆分字符串由正则表达式而不是一组字符确定。
这一切都很好。
欢迎更深入的回答。