NSString+Etoile documentation

Authors

Quentin Mathe (qmathe@club-internet.fr)
NSString additions.

Copyright: (C) 2007 Quentin Mathe

Software documentation for the NSString(Etoile) category

NSString(Etoile)

Declared in:
NSString+Etoile.h

@group String Manipulation and Formatting

Method summary

firstPathComponent 

- (NSString*) firstPathComponent;

Returns the first path component of the receiver. If the receiver isn't a path, returns the a new instance of the entire string.

If the path is '/', returns '/'.
If the path is '/where/who' or 'where/who', returns 'where'.


indexPathBySplittingPathWithSeparator: 

- (NSIndexPath*) indexPathBySplittingPathWithSeparator: (NSString*)separator;
Description forthcoming.

stringByCapitalizingFirstLetter 

- (NSString*) stringByCapitalizingFirstLetter;

Returns a string where the first letter is capitalized and the other letter case remains the same (unlike -capitalizedString). Useful to create accessor names from Key-Value-Coding keys.


stringByDeletingFirstPathComponent 

- (NSString*) stringByDeletingFirstPathComponent;

Returns a new string instance by stripping the first path component as defined by -firstPathComponent .


stringByLowercasingFirstLetter 

- (NSString*) stringByLowercasingFirstLetter;

Returns a string where the first letter is lowercased and the other letter case remains the same. Useful to create accessor names from Key-Value-Coding keys. See also -stringByCapitalizingFirstLetter .


stringBySpacingCapitalizedWords 

- (NSString*) stringBySpacingCapitalizedWords;

Returns a string where all words are separated by spaces for a given string of capitalized words with no spaces at all.

Useful to convert a name in camel case into a more user friendly name.


stringByStandardizingIntoAbsolutePath 

- (NSString*) stringByStandardizingIntoAbsolutePath;

Returns a new string instance by first standardizing the path, then resolving remaining relative path components against the current directory to ensure the first path component is a '/' (the resulting path returns YES to -[NSString isAbsolutePath]).

See also -[NSString stringByStandardizingPath] and -[NSFileManager currentDirectoryPath].

For a current directory /home/john/documents , ../beach.jpg is resolved to /home/john/beach.jpg, and beach.jpg is resolved to /home/john/documents/beach.jpg.


substringFromIndex: toIndex: 

- (NSString*) substringFromIndex: (NSUInteger)startIndex toIndex: (NSUInteger)endIndex;

Returns the substring that starts at the first index and ends at the second index.

The character located at the start index is included in the returned string, unlike the character located at the end index which isn't included. This is a convenient alternative to -substringWithRange: which tends to be error-prone for most use cases.