diff options
author | Urban Müller | 2011-12-01 13:51:50 +0000 |
---|---|---|
committer | Urban Müller | 2011-12-01 13:51:50 +0000 |
commit | 9464c15f54a175ea907baeea1287e20d262b9224 (patch) | |
tree | 1a34c72134ca50f4cf180c586d6af1add3656d6e /it_pipe.class | |
parent | 41c247230916c505eae1a8c505fbcb72d2a047c3 (diff) | |
download | itools-9464c15f54a175ea907baeea1287e20d262b9224.tar.gz itools-9464c15f54a175ea907baeea1287e20d262b9224.tar.bz2 itools-9464c15f54a175ea907baeea1287e20d262b9224.zip |
docs for ->cols, configurable separtor
Diffstat (limited to 'it_pipe.class')
-rw-r--r-- | it_pipe.class | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/it_pipe.class b/it_pipe.class index f1cdf76..36e4f63 100644 --- a/it_pipe.class +++ b/it_pipe.class @@ -132,11 +132,16 @@ function ED() return $this; } -function cols($collist) +/** + * Convert every line into an object with named columns + * @param collist comma separator column name list + * @param separator split character ["\t"] + */ +function cols($collist, $separator = "\t") { $keys = explode(",", $collist); foreach ($this->lines as $idx => $line) - $this->lines[$idx] = (object)array_combine($keys, explode("\t", $line)); + $this->lines[$idx] = (object)array_combine($keys, explode($separator, $line)); return $this; } |