Skip to content

Instantly share code, notes, and snippets.

@shaneis
Last active November 23, 2018 15:56
Show Gist options
  • Save shaneis/a814e0e63dd3c9fb3a25f1c1ce76c956 to your computer and use it in GitHub Desktop.
Save shaneis/a814e0e63dd3c9fb3a25f1c1ce76c956 to your computer and use it in GitHub Desktop.
Have to use % to "go back to the start"
$String = 'SQL Server'
for ($i = 0; $i -lt $String.Length; $i++ ) {
[PSCustomObject]@{
'This Char' = $string[$i]
'Prev Char' = $string[$i -1]
'Next Char' = $string[($i +1) % $String.Length]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment