📜  powershell slice string - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:50:57.557000             🧑  作者: Mango

代码示例1
$myString = "helloWorld"

# using the range operator [(start_i)..(end_i)]
$myString[3..8] -join ''  # 'loWorl'
$myString[-4..3] -join ''  # 'orldhello'

# using .Substring(start_i, substring_length)
$myString.Substring(3, 3)  # loWorl
$myString.Substring(1)  # elloWorld