Declared in NSString+GBString.h
NSString+GBString.m

Overview

Provides string extensions that make the rest of parsing code simpler.

Tasks

Simplifying strings

Preparing nice descriptions

Getting information

Other Methods

Class Methods

defaultNormalizedDescriptionLength

Returns default maximum length of normalized string.

+ (NSUInteger)defaultNormalizedDescriptionLength

Declared In

NSString+GBString.h

stringByCombiningLines:delimitWith:

Creates a new NSString composed from all given lines delimited with the given delimiter.

+ (NSString *)stringByCombiningLines:(NSArray *)lines delimitWith:(NSString *)delimiter

Parameters

lines
Array of lines to combine.
delimiter
Delimiter to use to separate lines.

Return Value

Returns autoreleased string containing all lines.

Declared In

NSString+GBString.h

Instance Methods

arrayOfLines

Returns the array of all lines in the receiver.

- (NSArray *)arrayOfLines

Return Value

Returns the array of all lines.

See Also

Declared In

NSString+GBString.h

normalizedDescription

Returns normalized description from the receiver.

- (NSString *)normalizedDescription

Return Value

Returns stripped description.

Discussion

The main purpose of this method is to strip and wordifiy long descriptions by making them suitable for logging and debug messages.

Declared In

NSString+GBString.h

normalizedDescriptionWithMaxLength:

Returns normalized description from the receiver.

- (NSString *)normalizedDescriptionWithMaxLength:(NSUInteger)length

Parameters

length
Maximum length of the description.

Return Value

Returns stripped description.

Discussion

The main purpose of this method is to strip and wordifiy long descriptions by making them suitable for logging and debug messages.

Declared In

NSString+GBString.h

numberOfLines

Returns the number of all lines in the receiver.

- (NSUInteger)numberOfLines

Return Value

Returns the number of all lines in the receiver.

Declared In

NSString+GBString.h

numberOfLinesInRange:

Calculates the numer of lines in the given range of the receiver.

- (NSUInteger)numberOfLinesInRange:(NSRange)range

Parameters

range
The range to use for calculation.

Return Value

Returns the number of lines in the given range.

Exceptions

NSException
Thrown if the given range is invalid.

See Also

Declared In

NSString+GBString.h

stringByTrimmingCharactersInSetFromEnd:

Trims all characters from the given set from the string end.

- (NSString *)stringByTrimmingCharactersInSetFromEnd:(NSCharacterSet *)set

Parameters

set
The set of characters to trim.

Return Value

Returns trimmed string.

Discussion

Works the same way as [NSString stringByTrimmingCharactersInSetFromEnd:] except it trims from end only.

Exceptions

NSException
Thrown if the given set is nil.

Declared In

NSString+GBString.h

stringByTrimmingWhitespace

Trims all whitespace from the start and end of the string and returns trimmed value.

- (NSString *)stringByTrimmingWhitespace

Return Value

Returns trimmed string.

Declared In

NSString+GBString.h

stringByTrimmingWhitespaceAndNewLine

Trims all whitespace and new lines from the start and end of the string and returns trimmed value.

- (NSString *)stringByTrimmingWhitespaceAndNewLine

Return Value

Returns trimmed string.

Declared In

NSString+GBString.h

stringByWordifyingWithSpaces

Splits the string to words and returns all words separed by single space.

- (NSString *)stringByWordifyingWithSpaces

Return Value

Returns wordified string.

Declared In

NSString+GBString.h