title: vbscript How do I find "-" in a string and place characters that follow in a new string?
body: <p>I'm using vbscript, how do I find the hyphen character "-" in a string and place characters that follow in a new string? </p>
  
  <p>Basically my computer names end with a room number</p>
  
  <p>PC1-3 (room 3) , PC1-4 (room 4) etc</p>
  
  <p>I'm using </p>
  
  <pre><code>Dim roomArray(2)
  roomArray = Array("-1", "-2", "-3")
  
  Dim item
  For each item in roomArray
   If instr(strComputerName, item)
     ..do something
   End If
  Next
  </code></pre>
  
  <p>but I'm getting false positives due to room -33 containing "-3" etc so if I locate "-" in the string and place the characters that follow into a string I can check against the full string rather than using instr.</p>
  
  <p>Thanks for any help.</p>