RowConfig

com.phasmidsoftware.tableparser.core.parse.RowConfig
See theRowConfig companion object
case class RowConfig(delimiter: Char = ..., quote: Char = ..., listSep: Char = ..., listEnclosure: String = ..., trim: Boolean = ..., maybeString: Option[Regex] = ...)

Case class to define the configuration for parsing a row (see LineParser).

The default reads CSV as defined by RFC 4180 (https://www.rfc-editor.org/rfc/rfc4180): fields are separated by commas, and spaces are part of a field; a field may be quoted (with "), in which case it may contain commas, line breaks and quotes (which are doubled).

The regular expressions which LineParser uses are derived from the characters, so that changing the delimiter (for example) changes everything that depends on it. Use the copy methods (withDelimiter, etc.) to change one property, e.g. given RowConfig = RowConfig.default.withDelimiter('\t') or simply given RowConfig = RowConfig(delimiter = '\t').

Value parameters

delimiter

the character which separates fields. Defaults to ','.

listEnclosure

the (two) characters which enclose a list within a field, or "" if lists are not enclosed. Defaults to "{}".

listSep

the character which separates the elements of a list within a field. Defaults to '|'.

maybeString

an explicit Regex for a field which is not quoted, if the default (any characters other than the delimiter and the quote) is not wanted.

quote

the character which encloses a quoted field. Defaults to '"'.

trim

if true, any spaces next to a delimiter are ignored (so that "a, b" has the fields "a" and "b"), as in 1.x; this is not RFC 4180. Defaults to false.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
infix def withDelimiter(c: Char): RowConfig
infix def withListEnclosure(w: String): RowConfig
infix def withListSep(c: Char): RowConfig
infix def withQuote(c: Char): RowConfig
infix def withString(r: Regex): RowConfig
infix def withTrim(b: Boolean): RowConfig

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product

Concrete fields

The CsvAttributes for writing tables as this RowConfig reads them. If trim is true, the delimiter is followed by a space.

The CsvAttributes for writing tables as this RowConfig reads them. If trim is true, the delimiter is followed by a space.

Attributes

lazy val delimiterRegex: Regex

The Regex which matches a delimiter (with any spaces around it, if trim is true).

The Regex which matches a delimiter (with any spaces around it, if trim is true).

Attributes

lazy val string: Regex

The Regex which matches a field which is not quoted: maybeString if it is defined; otherwise, any characters other than the delimiter and the quote (if trim is true, not ending with a space, which belongs to the following delimiter).

The Regex which matches a field which is not quoted: maybeString if it is defined; otherwise, any characters other than the delimiter and the quote (if trim is true, not ending with a space, which belongs to the following delimiter).

Attributes