getTsvFieldValue

getTsvFieldValue extracts the value of a single field from a delimited text string.

This is a convenience function intended for cases when only a single field from an input line is needed. If multiple values are needed, it will be more efficient to work directly with std.algorithm.splitter or the InputFieldReordering class.

The input text is split by a delimiter character. The specified field is converted to the desired type and the value returned.

An exception is thrown if there are not enough fields on the line or if conversion fails. Conversion is done with std.conv.to, it throws a std.conv.ConvException on failure. If not enough fields, the exception text is generated referencing 1-upped field numbers as would be provided by command line users.

T
getTsvFieldValue
pure @safe
(
T
C
)
(
const C[] line
,
size_t fieldIndex
,
)
if (
isSomeChar!C
)

Meta