angular-l10n
Version:
An Angular library to translate messages, dates and numbers
28 lines (27 loc) • 1 kB
TypeScript
import { LocaleService } from './locale.service';
export interface ILocaleValidation {
parseNumber(s: string, digits?: string, defaultLocale?: string): number | null;
}
/**
* Provides the methods for locale validation.
*/
export declare class LocaleValidation implements ILocaleValidation {
private locale;
private decimalCode;
private numberCodes;
constructor(locale: LocaleService);
/**
* Converts a string to a number according to default locale.
* If the string cannot be converted to a number, returns NaN.
* @param s The string to be parsed
* @param digits An alias of the format. Default is '1.0-3'
* @param defaultLocale The default locale to use. Default is the current locale
*/
parseNumber(s: string, digits?: string, defaultLocale?: string): number | null;
private validateNumber;
private getDecimalCode;
private getNumberCodes;
private toChar;
private toUnicode;
private toHex;
}