Text and strings in Objective C

As mentioned earlier, NSCharacterSet represents various groupings of characters that are used by the NSString and NSScanner classes.

NSCharacterSet

Here is the set of methods available in NSCharacterSet which represent the various character sets.

  • alphanumericCharacterSet – Returns a character set containing the characters in the categories Letters, Marks, and Numbers.
  • capitalizedLetterCharacterSet – Returns a character set containing the characters in the category of Titlecase Letters.
  • characterSetWithCharactersInString – Returns a character set containing the characters in a given string.
  • characterSetWithRange: – Returns a character set containing characters with Unicode values in a given range.
  • illegalCharacterSet – Returns a character set containing values in the category of Non-Characters or that have not yet been defined in version 3.2 of the Unicode standard.
  • letterCharacterSet – Returns a character set containing the characters in the categories Letters and Marks.
  • lowercaseLetterCharacterSet – Returns a character set containing the characters in the category of Lowercase Letters.
  • newlineCharacterSet – Returns a character set containing the newline characters.
  • punctuationCharacterSet – Returns a character set containing the characters in the category of Punctuation.
  • symbolCharacterSet – Returns a character set containing the characters in the category of Symbols.
  • uppercaseLetterCharacterSet – Returns a character set containing the characters in the categories of Uppercase Letters and Titlecase Letters.
  • whitespaceAndNewlineCharacterSet – Returns a character set containing Unicode General Category Z*, U000A ~ U000D, and U0085.
  • whitespaceCharacterSet – Returns a character set containing only the in-line whitespace characters space (U+0020) and tab (U+0009).

Simple Example

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: