diff --git a/Source/NSScanner.m b/Source/NSScanner.m index abb34a1d0..ee07b8a7a 100644 --- a/Source/NSScanner.m +++ b/Source/NSScanner.m @@ -117,7 +117,7 @@ typedef struct { } } -/* +/** * Create and return a scanner that scans aString.
* Uses -initWithString: and with no locale set. */ @@ -933,6 +933,18 @@ typedef struct { *

To count the occurrances of string, this should be used in * conjunction with the -scanString:intoString: method. *

+ * + * NSString *ch = @"["; + * unsigned total = 0; + * + * [scanner scanUpToString: ch intoString: NULL]; + * while ([scanner scanString: ch intoString: NULL] == YES) + * { + * total++; + * [scanner scanUpToString: ch intoString: NULL]; + * } + * NSLog(@"total %d", total); + * */ - (BOOL) scanUpToString: (NSString *)string intoString: (NSString **)value