title: use NSScanner to parse string
body: <p>The two-line string to parse is:    </p>
  
  <pre><code>00:02.0 VGA compatible controller [0300]: Intel Corporation 82945G/GZ Integrated Graphics Controller [8086:2772] (rev 02)
  00:02.1 Display controller [0380]: Intel Corporation 82945G/GZ Integrated Graphics Controller [8086:2776] (rev 02)
  </code></pre>
  
  <p>to get these strings out:</p>
  
  <p>(from 1st line)</p>
  
  <ul>
  <li>VGA compatible controller</li>
  <li>Intel Corporation 82945G/GZ Integrated Graphics Controller</li>
  <li>[8086:2772]</li>
  </ul>
  
  <p>(from 2nd line)</p>
  
  <ul>
  <li>Display controller</li>
  <li>Intel Corporation 82945G/GZ Integrated Graphics Controller</li>
  <li>[8086:2776]</li>
  </ul>
  
  <p>Now my starting code is:</p>
  
  <pre><code>NSScanner *scn = [NSScanner scannerWithString:strtoparse];
  NSString *devtype;      
  while ([scn isAtEnd] == NO)
      {
         if( [scn scanUpToCharactersFromSet:[NSCharacterSet whitespaceCharacterSet] intoString:NULL] &amp;&amp;
          [scn scanUpToString:@"[" intoString:&amp;devtype]);
      }
  </code></pre>
  
  <p>and this aint working. I cant even understand the scanner from the docs. So can someone post working code?</p>