{{error}}
{{(quickSearchResults.length>10)?'10+':(quickSearchResults.length)}} {{(quickSearchResults.length==1)?'result':'results'}}
{{result.title}} {{result.timeStamp | mysql2ymd }}
I am sorry, no such article was written yet.
Simple code that is converting a list of maps to a pipe-separated text
Simple code that is converting a list of maps to a pipe-separated text
Simple code that is converting a list of maps to a pipe-separated text
Psv.groovy
static String toString(List<Map<String, Object>> data) {
        List<String> header = data*.keySet().flatten().unique()*.toString()
        List<List<String>> cells = ([header] + (0..data.size() - 1).collect { row ->
            header.collect { key -> (data[row][key] as String) ?: '' }
        }).transpose().collect { column -> column*.padRight(column*.length().max()) }.transpose()
        return cells.collect { row -> "|" + row.join("|") + "|" }.join("\r\n")
    }