From 51aa80aeb2c94be98ba894094f226e828d173be7 Mon Sep 17 00:00:00 2001 From: CaS Date: Tue, 22 Apr 2003 15:18:44 +0000 Subject: [PATCH] Add trivial example git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16515 72102866-910b-0410-8b05-ffd578937521 --- Source/NSScanner.m | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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