Have to use % to "go back to the start"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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