FoundationExtension
FoundationExtension is common Foundation/UIKit/Cocoa shortcuts and snippets collection.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
NSString(Shortcuts) Category Reference

NSString method shortcuts. More...

#import <NSString.h>

Instance Methods

Format
(NSString *) - format:
 Returns a string made by using self as a format string template into which the argument values are substituted. More...
 
(NSString *) - format0:
 Returns a string made by using self as a format string template into which the remaining argument values are substituted. More...
 
Range
(NSRange) - range
 Returns range of string. More...
 
(NSString *) - substringFromIndex:length:
 Returns a new string containing the characters of the receiver from the one at a given index with a given length. More...
 
(NSString *) - substringFromIndex:toIndex:
 Returns a new string containing the characters of the receiver from the one at a given index to the other given index. More...
 
(NSString *) - stringByTrimmingWhitespaceCharacters
 Returns a new string made by removing from both ends of the receiver characters contained in whitespace character set. More...
 
(NSString *) - stringByTrimmingWhitespaceAndNewlineCharacters
 Returns a new string made by removing from both ends of the receiver characters contained in whitespace and newline character set. More...
 
(NSString *) - stringByTrimmingNewlineCharacters
 Returns a new string made by removing from both ends of the receiver characters contained in newline character set. More...
 

Detailed Description

NSString method shortcuts.

Method Documentation

- (NSString *) format0: (nullable id)  dummyLikeNil
,   ... 

Returns a string made by using self as a format string template into which the remaining argument values are substituted.

Parameters
dummyLikeNilDo nothing. Value will be ignored. This is placeholder
...A comma-separated list of arguments to substitute into format.
Returns
A string created by using self as a template into which the remaining argument values are substituted according to the canonical locale.

This ignores first argument. Pass anything.

See also
format:
stringWithFormat:
- (NSString *) format: (id)  first
,   ... 

Returns a string made by using self as a format string template into which the argument values are substituted.

Parameters
first,...A comma-separated list of arguments to substitute into format. first should be id type.
Returns
A string created by using self as a template into which the argument values are substituted according to the canonical locale.

This requires first argument type to be id. To avoid this problems, use format0:.

Warning
Implementation of this method is not optimized enough so this is slow for some case.
See also
format0:
stringWithFormat:
- (NSRange) range

Returns range of string.

See also
NSRangeFromString
- (NSString *) stringByTrimmingNewlineCharacters

Returns a new string made by removing from both ends of the receiver characters contained in newline character set.

Returns
A new string made by removing from both ends of the receiver characters contained in newline character set. If the receiver is composed entirely of characters from newline character set, the empty string is returned.
See also
stringByTrimmingCharactersInSet:
NSCharacterSet newlineCharacterSet
- (NSString *) stringByTrimmingWhitespaceAndNewlineCharacters

Returns a new string made by removing from both ends of the receiver characters contained in whitespace and newline character set.

Returns
A new string made by removing from both ends of the receiver characters contained in whitespace and newline character set. If the receiver is composed entirely of characters from whitespace and newline character set, the empty string is returned.
See also
stringByTrimmingCharactersInSet:
NSCharacterSet whitespaceAndNewlineCharacterSet
- (NSString *) stringByTrimmingWhitespaceCharacters

Returns a new string made by removing from both ends of the receiver characters contained in whitespace character set.

Returns
A new string made by removing from both ends of the receiver characters contained in whitespace character set. If the receiver is composed entirely of characters from whitespace character set, the empty string is returned.
See also
stringByTrimmingCharactersInSet:
NSCharacterSet whitespaceCharacterSet
- (NSString *) substringFromIndex: (NSUInteger)  from
length: (NSUInteger)  length 

Returns a new string containing the characters of the receiver from the one at a given index with a given length.

Parameters
fromAn index. The value must lie within the bounds of the receiver, or be equal to the length of the receiver.
lengthA length. The summation of this value and from index must lie within the bounds of the receiver, or be equal to the length of the receiver.
Returns
new string containing the characters of the receiver from the one at from index with given length.
See also
substringWithRange:
- (NSString *) substringFromIndex: (NSUInteger)  from
toIndex: (NSUInteger)  to 

Returns a new string containing the characters of the receiver from the one at a given index to the other given index.

Parameters
fromAn index. The value must lie within the bounds of the receiver, or be equal to the length of the receiver.
toAn index. The value must lie within the bounds of the receiver, or be equal to the length of the receiver.
Returns
new string containing the characters of the receiver from the one at from index to to index.
See also
substringWithRange:

The documentation for this category was generated from the following file: