RBLocaleCenter Class Reference

Inherits from NSObject
Declared in RBLocaleCenter.h

Overview

Provides locality-specific serialisations and conversions - e.g. dates, numbers, currencies, etc.

+ main

The main locale center.

+ (nonnull RBLocaleCenter *)main

Declared In

RBLocaleCenter.h

  defaultNumberStyle

The default number formatting style.

@property (nonatomic) NSNumberFormatterStyle defaultNumberStyle

Declared In

RBLocaleCenter.h

  defaultDateStyle

The default date formatting style.

@property (nonatomic) NSDateFormatterStyle defaultDateStyle

Declared In

RBLocaleCenter.h

  defaultTimeStyle

The default time formatting style.

@property (nonatomic) NSDateFormatterStyle defaultTimeStyle

Declared In

RBLocaleCenter.h

– numberFromString:

Parses a string to retrieve a number.

- (nullable NSNumber *)numberFromString:(nonnull NSString *)numberString

Parameters

numberString

The string that contains a number.

Return Value

The resulting NSNumber object or nil.

Declared In

RBLocaleCenter.h

– numberFromString:usingStyle:

Parses a string to retrieve a number.

- (nullable NSNumber *)numberFromString:(nonnull NSString *)numberString usingStyle:(NSNumberFormatterStyle)numberStyle

Parameters

numberString

The string that contains a number.

numberStyle

The formatting style to expect in the string.

Return Value

The resulting NSNumber object or nil.

Declared In

RBLocaleCenter.h

– stringFromNumber:

Formats a number to a string.

- (nonnull NSString *)stringFromNumber:(nonnull NSNumber *)number

Parameters

number

The number to format.

Return Value

The resulting formatted string.

Declared In

RBLocaleCenter.h

– stringFromNumber:usingStyle:

Formats a number to a string.

- (nonnull NSString *)stringFromNumber:(nonnull NSNumber *)number usingStyle:(NSNumberFormatterStyle)numberStyle

Parameters

number

The number to format.

numberStyle

The formatting style to use.

Return Value

The resulting formatted string.

Declared In

RBLocaleCenter.h

– dateFromString:universalTime:

Parses a date from a string.

- (nonnull NSDate *)dateFromString:(nonnull NSString *)dateString universalTime:(BOOL)universalTime

Parameters

dateString

The string to parse.

universalTime

Whether the date is UTC.

Return Value

The parsed NSDate object.

Declared In

RBLocaleCenter.h

– dateFromString:usingDateStyle:timeStyle:universalTime:

Parses a date from a string.

- (nullable NSDate *)dateFromString:(nonnull NSString *)dateString usingDateStyle:(NSDateFormatterStyle)dateStyle timeStyle:(NSDateFormatterStyle)timeStyle universalTime:(BOOL)universalTime

Parameters

dateString

The string to parse.

dateStyle

The formatting style to expect for the date component of the string.

timeStyle

The formatting style to expect for the time component of the string.

universalTime

Whether the date is UTC.

Return Value

The parsed NSDate object.

Declared In

RBLocaleCenter.h

– stringFromDate:universalTime:

Formats an NSDate into a string.

- (nonnull NSString *)stringFromDate:(nonnull NSDate *)date universalTime:(BOOL)universalTime

Parameters

date

The NSDate to format.

universalTime

Whether the date is UTC.

Return Value

The formatted string value.

Declared In

RBLocaleCenter.h

– stringFromDate:usingDateStyle:timeStyle:universalTime:

Formats an NSDate into a string.

- (nonnull NSString *)stringFromDate:(nonnull NSDate *)date usingDateStyle:(NSDateFormatterStyle)dateStyle timeStyle:(NSDateFormatterStyle)timeStyle universalTime:(BOOL)universalTime

Parameters

date

The NSDate to format.

dateStyle

The formatting style to use for the date component.

timeStyle

The formatting style to use for the time component.

universalTime

Whether the date is UTC.

Return Value

The formatted string value.

Declared In

RBLocaleCenter.h