Answers for "powershell slice string"

0

powershell slice string

$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
Posted by: Guest on April-23-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language