Home Reference Source Repository
import Format from 'cs/src/formats/Format.js'
public class | source

Format

You can directly use instance of this class. format

Format descriptor. Describes the format of a string; including how it is delimited and the fields present.

Method Summary

Public Methods
public

match(string: String): Boolean

Match Format.

public

parse(string: String): Object

Parse Format.

Public Methods

public match(string: String): Boolean source

Match Format. Matches a string against this format to see if the string is in this format.

Params:

NameTypeAttributeDescription
string String

string to match against.

Return:

Boolean

true if the string matches this format; false otherwise.

public parse(string: String): Object source

Parse Format. Parses a string with this format. Parses all of the fields in this format, delimited by its delimitor. Looks for fields in order of appearance after the string is tokenized. Each field can also be filtered through optional filters.

Params:

NameTypeAttributeDescription
string String

string to parse.

Return:

Object

a parsed object containing the fields in this format