Inherits from NSFormatter
Declared in SHSPhoneNumberFormatter.h
SHSPhoneNumberFormatter.m

Overview

Formatter class that converts input string to phone format.

Properties

canAffectLeftViewByFormatter

If you want to use leftView or leftViewMode property set this property to NO. Default is NO.

@property (readwrite) BOOL canAffectLeftViewByFormatter

Discussion

If you want to use leftView or leftViewMode property set this property to NO. Default is NO.

Declared In

SHSPhoneNumberFormatter.h

prefix

Prefix for all formats.

@property (copy, nonatomic) NSString *prefix

Discussion

Prefix for all formats.

Declared In

SHSPhoneNumberFormatter.h

Class Methods

digitOnlyString:

Returns all digits from string.

+ (NSString *)digitOnlyString:(NSString *)aString

Discussion

Returns all digits from string.

Declared In

SHSPhoneNumberFormatter.h

formattedRemove:AtIndex:

Remove required number of digits in phone text.

+ (NSString *)formattedRemove:(NSString *)string AtIndex:(NSRange)range

Discussion

Remove required number of digits in phone text.

Declared In

SHSPhoneNumberFormatter.h

isValuableChar:

Check if a chas is valuable symbol(part of number). Valuable chars are all digits.

+ (BOOL)isValuableChar:(unichar)ch

Discussion

Check if a chas is valuable symbol(part of number). Valuable chars are all digits.

Declared In

SHSPhoneNumberFormatter.h

valuableCharCountIn:

Returns a count of valuable symbols in string.

+ (NSInteger)valuableCharCountIn:(NSString *)string

Discussion

Returns a count of valuable symbols in string.

Declared In

SHSPhoneNumberFormatter.h

Instance Methods

addOutputPattern:forRegExp:

All number matched your regexp will formatted with your style. Symbol ‘#’ assumes all digits. Example: pattern is “+# (###) ###-##-##”, regexp is “^375\d*$”

- (void)addOutputPattern:(NSString *)pattern forRegExp:(NSString *)regexp

Discussion

All number matched your regexp will formatted with your style. Symbol ‘#’ assumes all digits. Example: pattern is “+# (###) ###-##-##”, regexp is “^375\d*$”

Declared In

SHSPhoneNumberFormatter+UserConfig.h

addOutputPattern:forRegExp:imagePath:

All number matched your regexp will formatted with your style and image Symbol ‘#’ assumes all digits. Example: pattern is “+# (###) ###-##-##”, imagePath is “flag_ru”, regexp is “^375\d*$”

- (void)addOutputPattern:(NSString *)pattern forRegExp:(NSString *)regexp imagePath:(NSString *)imagePath

Discussion

All number matched your regexp will formatted with your style and image Symbol ‘#’ assumes all digits. Example: pattern is “+# (###) ###-##-##”, imagePath is “flag_ru”, regexp is “^375\d*$”

Declared In

SHSPhoneNumberFormatter+UserConfig.h

resetFormats

Remove all patterns and apply clear format style. Default format is @“#############”, imagePath is nil.

- (void)resetFormats

Discussion

Remove all patterns and apply clear format style. Default format is @“#############”, imagePath is nil.

Declared In

SHSPhoneNumberFormatter+UserConfig.h

setDefaultOutputPattern:

Apply default format style. Symbol ‘#’ assumes all digits. Example is “+# (###) ###-##-##”

- (void)setDefaultOutputPattern:(NSString *)pattern

Discussion

Apply default format style. Symbol ‘#’ assumes all digits. Example is “+# (###) ###-##-##”

Declared In

SHSPhoneNumberFormatter+UserConfig.h

setDefaultOutputPattern:imagePath:

Apply default format style and image. Symbol ‘#’ assumes all digits. Example is “+# (###) ###-##-##”, imagePath is “flag_ru”.

- (void)setDefaultOutputPattern:(NSString *)pattern imagePath:(NSString *)imagePath

Discussion

Apply default format style and image. Symbol ‘#’ assumes all digits. Example is “+# (###) ###-##-##”, imagePath is “flag_ru”.

Declared In

SHSPhoneNumberFormatter+UserConfig.h

valuesForString:

Converts input string to dictionary. Return value format {text: “FORMATTED_PHONE_NUMBER”, image: “PATH_TO_IMAGE”} Image path can be nil

- (NSDictionary *)valuesForString:(NSString *)aString

Discussion

Converts input string to dictionary. Return value format {text: “FORMATTED_PHONE_NUMBER”, image: “PATH_TO_IMAGE”} Image path can be nil

Declared In

SHSPhoneNumberFormatter.h