Powershell Loop Through String Javascript Substring Function In Python