title: Adding substrings to array, and the deleting that substring from the parent string
body: <p>I cannot figure out how to do this. My current code is as follows:</p>
  
  <pre><code>[string]$strTest = Read-Host "Please input an IP host address in full dotted decimal.`n(Example: 192.168.004.214)"
  [array]$arrTest = 0
  $str = $strTest
  $fs = "."
  $index = $str.indexof($fs)
  $count = 1
  do{
      $chunk = $str.substring(0,$index)
      $arrTest += $chunk
      $count++
      $str = $str -replace ($chunk + ".", "")
      }
      until($count -eq 4) 
  
  $arrTest    
  </code></pre>
  
  <p>I want this to give me an array that's populated with each octet of the IP address, but I'm getting a strange result. Running this in ISE gives me:</p>
  
  <pre><code>0
  123
  123
  123
  </code></pre>
  
  <p>And I have no idea why.</p>