NSString(ETStringTampering) Category Reference
| Declared in | ETString.h |
Overview
NSString (ETStringTampering) is a category that expands NSString objects to provide formatting and validation specific methods.
Class Methods
formatCurrencyAmount:withLocale:
Formats a NSDecimalNumber object to a currency formatted NSString with the provided NSLocale.
+ (NSString *)formatCurrencyAmount:(NSDecimalNumber *)value withLocale:(NSLocale *)localeParameters
- value
The
NSDecimalNumberthat will be currency formatted.
- locale
The
NSLocalethat will be used to format the provided amount as a currencyNSString.
Return Value
The provided NSDecimalNumber formatted as a currency NSString using the provided NSLocale.
Declared In
ETString.hgenerateRandomStringWithLength:
Generate a NSString object with random characters with the length provided.
+ (NSString *)generateRandomStringWithLength:(NSInteger)lengthParameters
- length
The lenght of the randomly generated
NSString.
Return Value
A NSString object composed of random characters with a length equal to the provided parameter.
Declared In
ETString.hInstance Methods
containsNumbersOnly
Checks that every character on the NSString instance is a number type character.
- (BOOL)containsNumbersOnlyReturn Value
YES if all the characters contained on the NSString instance ara numbers NO otherwise.
Declared In
ETString.hcontainsString:
Checks if the NSString instance contains the provided substring within itself.
- (BOOL)containsString:(NSString *)subStringParameters
- subString
The
NSStringsubstring that needs to be contained in theNSStringinstance.
Return Value
YES if the provided subString is contained within the NSString instance NO otherwise.
Declared In
ETString.hparseQueryStringArg:
Extracts the part after the ‘=’ in a typical HTTP query string.
- (NSString *)parseQueryStringArg:(NSString *)argNameParameters
- argName
The name of the argument to look within the
URLprovided.
Return Value
The NSString object associated to the arument provided (if any, nil if none).
Discussion
NSString * url = http://www.someURL.dot?someArgument=foobar&anotherArgument=blarfo
NSString * arg = [url parseQueryStringArg:@"someArgument"];
arg is ‘foobar’
Declared In
ETString.h