NSString(GBString) Category Reference
Declared in | NSString+GBString.h NSString+GBString.m |
Tasks
Simplifying strings
-
– stringByTrimmingCharactersInSetFromEnd:
Trims all characters from the given set from the string end. -
– stringByWordifyingWithSpaces
Splits the string to words and returns all words separed by single space. -
– stringByTrimmingWhitespace
Trims all whitespace from the start and end of the string and returns trimmed value. -
– stringByTrimmingWhitespaceAndNewLine
Trims all whitespace and new lines from the start and end of the string and returns trimmed value.
Preparing nice descriptions
-
– normalizedDescription
Returns normalized description from the receiver. -
– normalizedDescriptionWithMaxLength:
Returns normalized description from the receiver. -
+ defaultNormalizedDescriptionLength
Returns default maximum length of normalized string.
Getting information
-
+ stringByCombiningLines:delimitWith:
Creates a newNSString
composed from all given lines delimited with the given delimiter. -
– arrayOfLines
Returns the array of all lines in the receiver. -
– numberOfLines
Returns 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. -
– stringByWordifyingWithSpaces
Splits the string to words and returns all words separed by single space. -
– stringByTrimmingWhitespace
Trims all whitespace from the start and end of the string and returns trimmed value. -
– stringByTrimmingWhitespaceAndNewLine
Trims all whitespace and new lines from the start and end of the string and returns trimmed value. -
– normalizedDescription
Returns normalized description from the receiver. -
– normalizedDescriptionWithMaxLength:
Returns normalized description from the receiver. -
+ defaultNormalizedDescriptionLength
Returns default maximum length of normalized string. -
+ stringByCombiningLines:delimitWith:
Creates a newNSString
composed from all given lines delimited with the given delimiter. -
– arrayOfLines
Returns the array of all lines in the receiver. -
– numberOfLines
Returns the number of all lines in the receiver. -
– numberOfLinesInRange:
Calculates the numer of lines in the given range of the receiver.
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.
See Also
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