UNPKG

@cute-dw/core

Version:

This TypeScript library is the main part of a more powerfull package designed for the fast WEB software development. The cornerstone of the library is the **DataStore** class, which might be useful when you need a full control of the data, but do not need

22 lines (21 loc) 1.25 kB
import { Format } from "./Format"; /** * String display formats can have three sections. The first is required and contains the format for strings, the second is optional and specifies how to represent nulls, the third is optional too and specifies a fill character (placeholder): `string-format[;null-format[;placeholder]]`. * In a string format mask, each at-sign (@) represents a character in the string and all other characters represent themselves. * @since 0.5.0 * @license MIT, (c) 2022 ALEXANDER STRELKOV, alv.strelkov@gmail.com */ export declare class StringFormat extends Format { /** * Returns a string value that was formatted with a string format mask `pattern` * @param value Source string or _null_ value * @param pattern Format mask devided by sections (optional) * @returns Formatted string * @static * @example * console.log( StringFormat.format("1234567890", "+7(@@@)@@@-@@-@@") ); // +7(123)456-78-90 * console.log( StringFormat.format(null, "+7(@@@)@@@-@@-@@;None") ); // None * console.log( StringFormat.format("", "+7(@@@)@@@-@@-@@;?;_") ); // +7(___)___-__-__ */ static format(value: string | null, pattern?: string): string; }