你好,歡迎來到IOS教程網

 Ios教程網 >> IOS編程開發 >> IOS開發綜合 >> iOS 基礎類解析 - NSCharacterSet

iOS 基礎類解析 - NSCharacterSet

編輯:IOS開發綜合

NSCharacterSet Class Reference

Inherits from NSObject Conforms to NSCoding
NSCopying
NSMutableCopying
NSObject (NSObject)
Framework /System/Library/Frameworks/Foundation.framework Availability Available in iOS 2.0 and later. Companion guide String Programming Guide
Declared in NSCharacterSet.h
NSURL.h
Related sample code Advanced UISearchBar KMLViewer MVCNetworking SimpleURLConnections Using NSXMLParser to parse XML documents

Overview

An NSCharacterSet object represents a set of Unicode-compliant characters. NSString and NSScanner objects use NSCharacterSet objects to group characters together for searching operations, so that they can find any of a particular set of characters during a search. The cluster’s two public classes, NSCharacterSet andNSMutableCharacterSet, declare the programmatic interface for static and dynamic character sets, respectively.

The objects you create using these classes are referred to as character set objects (and when no confusion will result, merely as character sets). Because of the nature of class clusters, character set objects aren’t actual instances of the NSCharacterSet or NSMutableCharacterSet classes but of one of their private subclasses. Although a character set object’s class is private, its interface is public, as declared by these abstract superclasses, NSCharacterSet and NSMutableCharacterSet. The character set classes adopt the NSCopying and NSMutableCopying protocols, making it convenient to convert a character set of one type to the other.

The NSCharacterSet class declares the programmatic interface for an object that manages a set of Unicode characters (see the NSString class cluster specification for information on Unicode). NSCharacterSet’s principal primitive method, characterIsMember:, provides the basis for all other instance methods in its interface. A subclass of NSCharacterSet needs only to implement this method, plus mutableCopyWithZone:, for proper behavior. For optimal performance, a subclass should also override bitmapRepresentation, which otherwise works by invoking characterIsMember: for every possible Unicode value.

NSCharacterSet is “toll-free bridged” with its Core Foundation counterpart, CFCharacterSetRef. See “Toll-Free Bridging” for more information on toll-free bridging.

The mutable subclass of NSCharacterSet is NSMutableCharacterSet.

Adopted Protocols

NSCoding
  • encodeWithCoder:

  • initWithCoder:

    NSCopying
    • copyWithZone:

      NSMutableCopying
      • mutableCopyWithZone:

        Tasks

        Creating a Standard Character Set

        • + alphanumericCharacterSet
        • + capitalizedLetterCharacterSet
        • + controlCharacterSet
        • + decimalDigitCharacterSet
        • + decomposableCharacterSet
        • + illegalCharacterSet
        • + letterCharacterSet
        • + lowercaseLetterCharacterSet
        • + newlineCharacterSet
        • + nonBaseCharacterSet
        • + punctuationCharacterSet
        • + symbolCharacterSet
        • + uppercaseLetterCharacterSet
        • + whitespaceAndNewlineCharacterSet
        • + whitespaceCharacterSet

          Creating a Character Set for URL Encoding

          • + URLFragmentAllowedCharacterSet
          • + URLHostAllowedCharacterSet
          • + URLPasswordAllowedCharacterSet
          • + URLPathAllowedCharacterSet
          • + URLQueryAllowedCharacterSet
          • + URLUserAllowedCharacterSet

            Creating a Custom Character Set

            • + characterSetWithCharactersInString:
            • + characterSetWithRange:
            • – invertedSet

              Creating and Managing Character Sets as Bitmap Representations

              • + characterSetWithBitmapRepresentation:
              • + characterSetWithContentsOfFile:
              • – bitmapRepresentation

                Testing Set Membership

                • – characterIsMember:
                • – hasMemberInPlane:
                • – isSupersetOfSet:
                • – longCharacterIsMember:



                  Copyright ? 2014 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2014-03-10




  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved