mapValueOf

inline fun CsvDataRow.mapValueOf(column: CsvColumn, transform: (String) -> String): List<String>

Applies transform to the value at the given column, returning a new list with the transformed value.

Return

a new list with the transformed value at the specified column

Usage example: replace value "Belarus" with "Weißrussland" in the "Name" column

val name = csv.header.columnByName("Name") as CsvColumn
val transformedCsv = csv.copy(
data = csv.data.map { row ->
row.mapValueOf(name) { value ->
if (value == "Belarus") "Weißrussland" else value
}
}
)

Parameters

column

the column whose value will be transformed

transform

function to apply to the value