![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/share/doc/gnustep-base-doc/Base/Reference/ |
Upload File : |
<?xml version="1.0"?> <!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 1.0.4//EN" "http://www.gnustep.org/gsdoc-1_0_4.dtd"> <gsdoc base="NSScanner" up="Base"> <head> <title>NSScanner class reference</title> <author name="Eric Norum"> <email address="eric@skatter.usask.ca"> eric@skatter.usask.ca </email> </author> <author name="Richard Frith-Macdonald"> <email address="rfm@gnu.org"> rfm@gnu.org </email> </author> <copy>1996,1999 Free Software Foundation, Inc.</copy> </head> <body> <front><contents /></front> <chapter> <heading> Software documentation for the NSScanner class </heading> <class name="NSScanner" super="NSObject" ovadd="1.0.0"> <declared>Foundation/NSScanner.h</declared> <conform>NSCopying</conform> <desc> <p> The <code>NSScanner</code> class cluster (currently a single class in GNUstep) provides a mechanism to parse the contents of a string into number and string values by making a sequence of scan operations to step through the string retrieving successive items. </p> <p> You can tell the scanner whether its scanning is supposed to be case sensitive or not, and you can specify a set of characters to be skipped before each scanning operation (by default, whitespace and newlines). </p> </desc> <method type="id" factory="yes" ovadd="1.0.0"> <sel>localizedScannerWithString:</sel> <arg type="NSString*">aString</arg> <desc> Returns an NSScanner instance set up to scan <var>aString</var> (using <ref type="method" id="-initWithString:"> -initWithString: </ref> and with a locale set the default locale (using <ref type="method" id="-setLocale:"> -setLocale: </ref> </desc> </method> <method type="id" factory="yes" ovadd="1.0.0"> <sel>scannerWithString:</sel> <arg type="NSString*">aString</arg> <desc> Create and return a scanner that scans <var>aString</var>. <br /> Uses <ref type="method" id="-initWithString:"> -initWithString: </ref> and with no locale set. </desc> </method> <method type="BOOL" ovadd="1.0.0"> <sel>caseSensitive</sel> <desc> If the scanner is set to be case-sensitive in its scanning of the string (other than characters to be skipped), this method returns <code>YES</code>, otherwise it returns <code>NO</code>. <br /> The default is for a scanner to <em>not</em> be case sensitive. </desc> </method> <method type="NSCharacterSet*" ovadd="1.0.0"> <sel>charactersToBeSkipped</sel> <desc> Returns a set of characters containing those characters that the scanner ignores when starting any scan operation. Once a character not in this set has been encountered during an operation, skipping is finished, and any further characters from this set that are found are scanned normally. <br /> The default for this is the whitespaceAndNewlineCharacterSet. </desc> </method> <method type="id" ovadd="1.0.0"> <sel>initWithString:</sel> <arg type="NSString*">aString</arg> <desc> Initialises the scanner to scan <var>aString</var>. The GNUstep implementation may make an internal copy of the original string - so it is not safe to assume that if you modify a mutable string that you initialised a scanner with, the changes will be visible to the scanner. <br /> Returns the scanner object. </desc> </method> <method type="BOOL" ovadd="1.0.0"> <sel>isAtEnd</sel> <desc> Returns <code>YES</code> if no more characters remain to be scanned. <br /> Returns <code>YES</code> if all characters remaining to be scanned are to be skipped. <br /> Returns <code>NO</code> if there are characters left to scan. </desc> </method> <method type="NSDictionary*" ovadd="1.0.0"> <sel>locale</sel> <desc> Returns the locale set for the scanner, or <code>nil</code> if no locale has been set. A scanner uses it's locale to alter the way it handles scanning - it uses the NSDecimalSeparator value for scanning numbers. </desc> </method> <method type="BOOL" ovadd="1.0.0"> <sel>scanCharactersFromSet:</sel> <arg type="NSCharacterSet*">aSet</arg> <sel>intoString:</sel> <arg type="NSString**">value</arg> <desc> After initial skipping (if any), this method scans any characters from <var>aSet</var>, terminating when a character not in the set is found. <br /> Returns <code>YES</code> if any character is scanned, <code>NO</code> otherwise. <br /> If <var>value</var> is not null, any character scanned are stored in a string returned in this location. </desc> </method> <method type="BOOL" ovadd="10.0.0"> <sel>scanDecimal:</sel> <arg type="NSDecimal*">value</arg> <desc> Not implemented. </desc> </method> <method type="BOOL" ovadd="1.0.0"> <sel>scanDouble:</sel> <arg type="double*">value</arg> <desc> After initial skipping (if any), this method scans a <strong>double</strong> <var>value</var>, placing it in <em>doubleValue</em> if that is not null. Returns <code>YES</code> if anything is scanned, <code>NO</code> otherwise. <br /> On overflow, HUGE_VAL or - HUGE_VAL is put into <em>doubleValue</em> <br /> On underflow, 0.0 is put into <em>doubleValue</em> <br /> Scans past any excess digits </desc> </method> <method type="BOOL" ovadd="1.0.0"> <sel>scanFloat:</sel> <arg type="float*">value</arg> <desc> After initial skipping (if any), this method scans a <strong>float</strong> <var>value</var>, placing it in <em>floatValue</em> if that is not null. Returns <code>YES</code> if anything is scanned, <code>NO</code> otherwise. <br /> On overflow, HUGE_VAL or - HUGE_VAL is put into <em>floatValue</em> <br /> On underflow, 0.0 is put into <em>floatValue</em> <br /> Scans past any excess digits </desc> </method> <method type="BOOL" ovadd="10.5.0"> <sel>scanHexDouble:</sel> <arg type="double*">result</arg> <desc> Not implemented </desc> </method> <method type="BOOL" ovadd="10.5.0"> <sel>scanHexFloat:</sel> <arg type="float*">result</arg> <desc> Not implemented </desc> </method> <method type="BOOL" ovadd="1.0.0"> <sel>scanHexInt:</sel> <arg type="unsigned int*">value</arg> <desc> After initial skipping (if any), this method scans a hexadecimal integer <var>value</var> (optionally prefixed by "0x" or "0X"), placing it in <em>intValue</em> if that is not null. <br /> Returns <code>YES</code> if anything is scanned, <code>NO</code> otherwise. <br /> On overflow, INT_MAX or INT_MIN is put into <em>intValue</em> <br /> Scans past any excess digits </desc> </method> <method type="BOOL" ovadd="10.5.0"> <sel>scanHexLongLong:</sel> <arg type="unsigned long long*">value</arg> <desc> After initial skipping (if any), this method scans a hexadecimal <strong>long</strong> <strong>long</strong> <var>value</var> (optionally prefixed by "0x" or "0X"), placing it in <em>longLongValue</em> if that is not null. <br /> Returns <code>YES</code> if anything is scanned, <code>NO</code> otherwise. <br /> On overflow, ULLONG_MAX or ULLONG_MAX is put into <em>longLongValue</em> <br /> Scans past any excess digits </desc> </method> <method type="BOOL" ovadd="1.0.0"> <sel>scanInt:</sel> <arg type="int*">value</arg> <desc> After initial skipping (if any), this method scans a integer <var>value</var>, placing it in <em>intValue</em> if that is not null. <br /> Returns <code>YES</code> if anything is scanned, <code>NO</code> otherwise. <br /> On overflow, INT_MAX or INT_MIN is put into <em>intValue</em> <br /> Scans past any excess digits </desc> </method> <method type="BOOL" ovadd="10.5.0"> <sel>scanInteger:</sel> <arg type="NSInteger*">value</arg> <desc> Not implemented </desc> </method> <method type="NSUInteger" ovadd="1.0.0"> <sel>scanLocation</sel> <desc> Returns the current position that the scanner has reached in scanning the string. This is the position at which the next scan operation will begin. </desc> </method> <method type="BOOL" ovadd="1.0.0"> <sel>scanLongLong:</sel> <arg type="long long*">value</arg> <desc> After initial skipping (if any), this method scans a <strong>long</strong> decimal integer <var>value</var> placing it in <em>longLongValue</em> if that is not null. <br /> Returns <code>YES</code> if anything is scanned, <code>NO</code> otherwise. <br /> On overflow, LLONG_MAX or LLONG_MIN is put into <em>longLongValue</em> <br /> Scans past any excess digits </desc> </method> <method type="BOOL" ovadd="0.0.0" ovrem="0.0.0"> <sel>scanRadixUnsignedInt:</sel> <arg type="unsigned int*">value</arg> <desc> After initial skipping (if any), this method scans an <strong>unsigned</strong> integer placing it in <em><var>value</var></em> if that is not null. If the number begins with "0x" or "0X" it is treated as hexadecimal, otherwise if the number begins with "0" it is treated as octal, otherwise the number is treated as decimal. <br /> Returns <code>YES</code> if anything is scanned, <code>NO</code> otherwise. <br /> On overflow, UINT_MAX is put into <em><var>value</var></em> <br /> Scans past any excess digits </desc> </method> <method type="BOOL" ovadd="0.0.0" ovrem="0.0.0"> <sel>scanRadixUnsignedLongLong:</sel> <arg type="unsigned long long*">value</arg> <desc> After initial skipping (if any), this method scans an <strong>unsigned</strong> <strong>long</strong> <strong>long</strong> integer placing it in <em><var>value</var></em> if that is not null. If the number begins with "0x" or "0X" it is treated as hexadecimal, otherwise if the number begins with "0" it is treated as octal, otherwise the number is treated as decimal. <br /> Returns <code>YES</code> if anything is scanned, <code>NO</code> otherwise. <br /> On overflow, ULLONG_MAX is put into <em><var>value</var></em> <br /> Scans past any excess digits </desc> </method> <method type="BOOL" ovadd="1.0.0"> <sel>scanString:</sel> <arg type="NSString*">string</arg> <sel>intoString:</sel> <arg type="NSString**">value</arg> <desc> After initial skipping (if any), this method scans for <var>string</var> and places the characters found in <var>value</var> if that is not null. <br /> Returns <code>YES</code> if anything is scanned, <code>NO</code> otherwise. </desc> </method> <method type="BOOL" ovadd="1.0.0"> <sel>scanUpToCharactersFromSet:</sel> <arg type="NSCharacterSet*">aSet</arg> <sel>intoString:</sel> <arg type="NSString**">value</arg> <desc> After initial skipping (if any), this method scans characters until it finds one in <em>set</em>. The scanned characters are placed in <em>stringValue</em> if that is not null. <br /> Returns <code>YES</code> if anything is scanned, <code>NO</code> otherwise. </desc> </method> <method type="BOOL" ovadd="1.0.0"> <sel>scanUpToString:</sel> <arg type="NSString*">string</arg> <sel>intoString:</sel> <arg type="NSString**">value</arg> <desc> <p> After initial skipping (if any), this method scans characters until it finds <var>string</var>. The scanned characters are placed in <var>value</var> if that is not null. If <var>string</var> is not found, all the characters up to the end of the scanned <var>string</var> will be returned. </p> Returns <code>YES</code> if anything is scanned, <code>NO</code> otherwise. <br /> <p> NB. If the current scanner location points to a copy of <var>string</var>, or points to skippable characters immediately before a copy of <var>string</var> then this method returns <code>NO</code> since it finds no characters to store in <var>value</var> before it finds <var>string</var>. </p> <p> To count the occurrences of <var>string</var>, this should be used in conjunction with the <ref type="method" id="-scanString:intoString:"> -scanString:intoString: </ref> method. </p> <example> 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); </example> </desc> </method> <method type="void" ovadd="1.0.0"> <sel>setCaseSensitive:</sel> <arg type="BOOL">flag</arg> <desc> Sets the case sensitivity of the scanner. <br /> Case sensitivity governs matching of characters being scanned, but does not effect the characters in the set to be skipped. <br /> The default is for a scanner to <em>not</em> be case sensitive. </desc> </method> <method type="void" ovadd="1.0.0"> <sel>setCharactersToBeSkipped:</sel> <arg type="NSCharacterSet*">aSet</arg> <desc> Sets the set of characters that the scanner will skip over at the start of each scanning operation to be <em>skipSet</em>. Skipping is performed by literal character matching - the case sensitivity of the scanner does not effect it. If this is set to <code>nil</code>, no skipping is done. <br /> The default for this is the whitespaceAndNewlineCharacterSet. </desc> </method> <method type="void" ovadd="1.0.0"> <sel>setLocale:</sel> <arg type="NSDictionary*">localeDictionary</arg> <desc> This method sets the locale used by the scanner to <em>aLocale</em>. The locale may be set to <code>nil</code>. </desc> </method> <method type="void" ovadd="1.0.0"> <sel>setScanLocation:</sel> <arg type="NSUInteger">anIndex</arg> <desc> This method sets the location in the scanned string at which the next scan operation begins. Raises an NSRangeException if index is beyond the end of the scanned string. </desc> </method> <method type="NSString*" ovadd="1.0.0"> <sel>string</sel> <desc> Returns the string being scanned. </desc> </method> </class> </chapter> </body> </gsdoc>