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