NSScanner Class Reference Data Management:Strings,Text,&Fonts
2010-03-18
Apple Inc.
©2010Apple Inc.
All rights rerved.
No part of this publication may be reproduced, stored in a retrieval system,or transmitted,in any form or by any means,mechanical, electronic,photocopying,recording,or otherwi,without prior written permission of Apple Inc.,with the following exceptions:Any person is hereby authorized to store documentation on a single computer for personal u only and to print copies of documentation for personal u provided that the documentation contains Apple’s copyright notice.
The Apple logo is a trademark of Apple Inc. U of the“keyboard”Apple logo
(Option-Shift-K)for commercial purpos without the prior written connt of Apple may constitute trademark infringement and unfair competition in violation of federal and state laws.
No licens,express or implied,are granted with respect to any of the technology described in this document.Apple retains all intellectual property rights associated with the technology described in this document.This document is intended to assist application developers to develop applications only for Apple-labeled computers.
Every effort has been made to ensure that the information in this document is accurate.Apple is not responsible for typographical errors. Apple Inc.
1Infinite Loop
Cupertino,CA95014
408-996-1010
Apple,the Apple logo,Mac,Mac OS,and Quartz are trademarks of Apple Inc.,registered in the United States and other countries. Simultaneously published in the United States and Canada.
Even though Apple has reviewed this document, APPLE MAKES NO WARRANTY OR REPRESENTATION, EITHER EXPRESS OR IMPLIED,WITH RESPECT TO THIS DOCUMENT,ITS QUALITY,ACCURACY, MERCHANTABILITY,OR FITNESS FOR A PARTICULAR PURPOSE.AS A R
榨菜蛋花汤ESULT,THIS DOCUMENT IS PROVIDED“AS IS,”AND YOU,THE READER,ARE ASSUMING THE ENTIRE RISK AS TO ITS QUALITY AND ACCURACY.
IN NO EVENT WILL APPLE BE LIABLE FOR DIRECT, INDIRECT,SPECIAL,INCIDENTAL,OR CONSEQUENTIAL DAMAGES RESULTING FROM ANY DEFECT OR INACCURACY IN THIS DOCUMENT,even if advid of the possibility of such damages. THE WARRANTY AND REMEDIES SET FORTH ABOVE ARE EXCLUSIVE AND IN LIEU OF ALL OTHERS,ORAL OR WRITTEN,EXPRESS OR IMPLIED.No Apple dealer,agent,or employee is authorized to make any modification,extension,or addition to this warranty.冬葵
Some states do not allow the exclusion or limitation of implied warranties or liability for incidental or conquential damages,so the above limitation or exclusion may not apply to you.This warranty gives you specific legal rights,and you may also have other rights which vary from state to state.
Contents
NSScanner Class Reference5
Overview5
Adopted Protocols6
Tasks6
Creating a Scanner6
Getting a Scanner’s String6
Configuring a Scanner6
Scanning a String7
Class Methods7
localizedScannerWithString:7
scannerWithString:8
Instance Methods8
caSensitive8
charactersToBeSkipped9
initWithString:9
isAtEnd10
locale10
scanCharactersFromSet:intoString:11
scanDecimal:11
scanDouble:12
scanFloat:12
scanHexDouble:13
scanHexFloat:14
scanHexInt:14空调模式
scanHexLongLong:14
scanInt:15
scanInteger:15
scanLocation16
scanLongLong:16
scanString:intoString:17
scanUpToCharactersFromSet:intoString:17
scanUpToString:intoString:18
tCaSensitive:19
tCharactersToBeSkipped:19
tLocale:20
tScanLocation:20
string21
Document Revision History23
3
CONTENTS 4
NSScanner Class Reference
Inherits from NSObject
Conforms to NSCopying
NSObject(NSObject)
Framework /System/Library/Frameworks/Foundation.framework
Availability Available in Mac OS X v10.0and later.
in后面加什么
Companion guide String Programming Guide
Declared in NSDecimalNumber.h
NSScanner.h
Related sample code iSpend
NumberInput_IMKit_Sample
QTAudioContextInrt
QTAudioExtractionPanel
花神泪Quartz Compor QCTV
Overview
The NSScanner class is an abstract superclass of a class cluster that declares the programmatic interface for
an object that scans values from an NSString object.
An NSScanner object interprets and converts the characters of an NSString object into number and string
values.You assign the scanner’s string on creating it,and the scanner progress through the characters of
that string from beginning to end as you request items.
Becau of the nature of class clusters,scanner objects aren’t actual instances of the NSScanner class but
one of its private subclass.Although a scanner object’s class is private,its interface is public,as declared
by this abstract superclass,NSScanner.The primitive methods of NSScanner are string (page 21)and all
of the methods listed under“Configuring a Scanner” (page 6)in the"Methods by Task"ction.The objects
you create using this class are referred to as scanner objects(and when no confusion will result,merely as
scanners).
You can t an NSScanner object to ignore a t of characters as it scans the string using the
tCharactersToBeSkipped: (page 19)method.The default t of characters to skip is the whitespace
and newline character t.
To retrieve the unscanned remainder of the string,u[[scanner
string]substringFromIndex:[scanner scanLocation]].
Overview5
NSScanner Class Reference
Adopted Protocols
NSCopying
– copyWithZone:
Tasks
Creating a Scanner
+ scannerWithString: (page 8)
Returns an NSScanner object that scans a given string.
+ localizedScannerWithString: (page 7)
Returns an NSScanner object that scans a given string according to the ur’s default locale.
– initWithString: (page 9)
Returns an NSScanner object initialized to scan a given string.
Getting a Scanner’s String
– string (page 21)
Returns the string with which the receiver was created or initialized.
创维电视说明书
Configuring a Scanner
伊丽莎白女王一世
– tScanLocation: (page 20)
生物秀Sets the location at which the next scan operation will begin to a given index.
– scanLocation (page 16)
Returns the character position at which the receiver will begin its next scanning operation.
– tCaSensitive: (page 19)
Sets whether the receiver is ca nsitive when scanning characters.
– caSensitive (page 8)
Returns a Boolean value that indicates whether the receiver distinguishes ca in the characters it
scans.
– tCharactersToBeSkipped: (page 19)
Sets the t of characters to ignore when scanning for a value reprentation.
– charactersToBeSkipped (page 9)
Returns a character t containing the characters the receiver ignores when looking for a scannable
element.
– tLocale: (page 20)
Sets the receiver’s locale to a given locale.
– locale (page 10)
Returns the receiver’s locale.
6Adopted Protocols