Oolite 1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
NSScanner(OOExtensions) Category Reference

#include <NSScannerOOExtensions.h>

Instance Methods

(BOOL) - ooliteScanCharactersFromSet:intoString:
 
(BOOL) - ooliteScanUpToCharactersFromSet:intoString:
 

Detailed Description

Definition at line 34 of file NSScannerOOExtensions.h.

Method Documentation

◆ ooliteScanCharactersFromSet:intoString:

- (BOOL) ooliteScanCharactersFromSet: (NSCharacterSet *) set
intoString: (NSString **) value 

Definition at line 1 of file NSScannerOOExtensions.m.

30 :(NSCharacterSet *)set intoString:(NSString **)value
31{
32 NSUInteger currentLocation = [self scanLocation];
33 NSRange matchedRange = NSMakeRange( currentLocation, 0);
34 NSString *scanString = [self string];
35 NSUInteger scanLength = [scanString length];
36
37 while ((currentLocation < scanLength)&&([set characterIsMember:[scanString characterAtIndex:currentLocation]]))
38 {
39 currentLocation++;
40 }
41
42 [self setScanLocation:currentLocation];
43
44 matchedRange.length = currentLocation - matchedRange.location;
45
46 if (!matchedRange.length) return NO;
47
48 if (value != NULL)
49 {
50 *value = [scanString substringWithRange:matchedRange];
51 }
52
53 return YES;
54}

◆ ooliteScanUpToCharactersFromSet:intoString:

- (BOOL) ooliteScanUpToCharactersFromSet: (NSCharacterSet *) set
intoString: (NSString **) value 

Definition at line 1 of file NSScannerOOExtensions.m.

57 :(NSCharacterSet *)set intoString:(NSString **)value
58{
59 NSUInteger currentLocation = [self scanLocation];
60 NSRange matchedRange = NSMakeRange( currentLocation, 0);
61 NSString *scanString = [self string];
62 NSUInteger scanLength = [scanString length];
63
64 while ((currentLocation < scanLength)&&(![set characterIsMember:[scanString characterAtIndex:currentLocation]]))
65 {
66 currentLocation++;
67 }
68
69 [self setScanLocation:currentLocation];
70
71 matchedRange.length = currentLocation - matchedRange.location;
72
73 if (!matchedRange.length) return NO;
74
75 if (value != NULL)
76 {
77 *value = [scanString substringWithRange:matchedRange];
78 }
79
80 return YES;
81}

The documentation for this category was generated from the following files: