Skip to content

Instantly share code, notes, and snippets.

@PrateekKumarSingh
Created October 9, 2018 18:45
Show Gist options
  • Save PrateekKumarSingh/2a5fa053633d9dfdbdffa40844b0b3cb to your computer and use it in GitHub Desktop.
Save PrateekKumarSingh/2a5fa053633d9dfdbdffa40844b0b3cb to your computer and use it in GitHub Desktop.
# substring\slicing as a character array using range '..' operator
$string = "My name is Prateek Singh`nI`'m from India"
# slicing the string from a specific index to another
$string[11..17] -join '' # output: Prateek
$string[11..23] -join '' # output: Prateek Singh
# slicing up to last index
$string[25..($string.Length-1)] -join '' # output: I'm from India
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment