28@implementation NSScanner (OOExtensions)
30- (BOOL) ooliteScanCharactersFromSet:(NSCharacterSet *)set intoString:(NSString **)value
32 NSUInteger currentLocation = [
self scanLocation];
33 NSRange matchedRange = NSMakeRange( currentLocation, 0);
34 NSString *scanString = [
self string];
35 NSUInteger scanLength = [scanString length];
37 while ((currentLocation < scanLength)&&([
set characterIsMember:[scanString characterAtIndex:currentLocation]]))
42 [
self setScanLocation:currentLocation];
44 matchedRange.length = currentLocation - matchedRange.location;
46 if (!matchedRange.length)
return NO;
50 *value = [scanString substringWithRange:matchedRange];
57- (BOOL) ooliteScanUpToCharactersFromSet:(NSCharacterSet *)set intoString:(NSString **)value
59 NSUInteger currentLocation = [
self scanLocation];
60 NSRange matchedRange = NSMakeRange( currentLocation, 0);
61 NSString *scanString = [
self string];
62 NSUInteger scanLength = [scanString length];
64 while ((currentLocation < scanLength)&&(![
set characterIsMember:[scanString characterAtIndex:currentLocation]]))
69 [
self setScanLocation:currentLocation];
71 matchedRange.length = currentLocation - matchedRange.location;
73 if (!matchedRange.length)
return NO;
77 *value = [scanString substringWithRange:matchedRange];