NSString(GBString) Category Reference
| Declared in | NSString+GBString.h NSString+GBString.m |
Overview
Provides string extensions that make the rest of parsing code simpler.
Tasks
Simplifying strings
-
- stringByTrimmingCharactersInSetFromEnd:Trims all characters from the given set from the string end. -
- stringByWordifyingWithSpacesSplits the string to words and returns all words separed by single space. -
- stringByTrimmingWhitespaceTrims all whitespace from the start and end of the string and returns trimmed value. -
- stringByTrimmingWhitespaceAndNewLineTrims all whitespace and new lines from the start and end of the string and returns trimmed value.
Preparing nice descriptions
-
- normalizedDescriptionReturns normalized description from the receiver. -
- normalizedDescriptionWithMaxLength:Returns normalized description from the receiver. -
+ defaultNormalizedDescriptionLengthReturns default maximum length of normalized string.
Getting information
-
- numberOfLinesReturns the number of all lines in the receiver. -
- numberOfLinesInRange:Calculates the numer of lines in the given range of the receiver.
Other Methods
-
- stringByTrimmingCharactersInSetFromEnd:Trims all characters from the given set from the string end. -
- stringByWordifyingWithSpacesSplits the string to words and returns all words separed by single space. -
- stringByTrimmingWhitespaceTrims all whitespace from the start and end of the string and returns trimmed value. -
- stringByTrimmingWhitespaceAndNewLineTrims all whitespace and new lines from the start and end of the string and returns trimmed value. -
- normalizedDescriptionReturns normalized description from the receiver. -
- normalizedDescriptionWithMaxLength:Returns normalized description from the receiver. -
+ defaultNormalizedDescriptionLengthReturns default maximum length of normalized string. -
- numberOfLinesReturns the number of all lines in the receiver. -
- numberOfLinesInRange:Calculates the numer of lines in the given range of the receiver.
Class Methods
Instance Methods
normalizedDescription
Returns normalized description from the receiver.
- (NSString *)normalizedDescriptionReturn Value
Returns stripped description.
Discussion
Returns normalized description from the receiver.
The main purpose of this method is to strip and wordifiy long descriptions by making them suitable for logging and debug messages.
See Also
Declared In
NSString+GBString.hnormalizedDescriptionWithMaxLength:
Returns normalized description from the receiver.
- (NSString *)normalizedDescriptionWithMaxLength:(NSUInteger)lengthParameters
- length
- Maximum length of the description.
Return Value
Returns stripped description.
Discussion
Returns normalized description from the receiver.
The main purpose of this method is to strip and wordifiy long descriptions by making them suitable for logging and debug messages.
See Also
Declared In
NSString+GBString.hnumberOfLines
Returns the number of all lines in the receiver.
- (NSUInteger)numberOfLinesReturn Value
Returns the number of all lines in the receiver.
See Also
Declared In
NSString+GBString.hnumberOfLinesInRange:
Calculates the numer of lines in the given range of the receiver.
- (NSUInteger)numberOfLinesInRange:(NSRange)rangeParameters
- 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.hstringByTrimmingCharactersInSetFromEnd:
Trims all characters from the given set from the string end.
- (NSString *)stringByTrimmingCharactersInSetFromEnd:(NSCharacterSet *)setParameters
- set
- The set of characters to trim.
Return Value
Returns trimmed string.
Discussion
Trims all characters from the given set from the string end.
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.hstringByTrimmingWhitespace
Trims all whitespace from the start and end of the string and returns trimmed value.
- (NSString *)stringByTrimmingWhitespaceReturn Value
Returns trimmed string.
See Also
Declared In
NSString+GBString.h