diff --git a/link b/link new file mode 100644 index 0000000..df07b7b --- /dev/null +++ b/link @@ -0,0 +1 @@ +https://www.includehelp.com/golang/read-data-from-file-till-specified-character-using-pre-defined-function.aspx \ No newline at end of file diff --git a/main.go b/main.go index 2689ae0..9c9c6c4 100644 --- a/main.go +++ b/main.go @@ -62,10 +62,15 @@ func putPage(b []byte) error { func _putPage(w io.Writer, b []byte, d byte, instances int) error { nonFirstColumn := []byte{} for _, line := range lines(b) { + line = bytes.TrimSpace(line) i := 0 for i < len(line) && line[i] == d { i += 1 } + if i > 20 { + nonFirstColumn = append(nonFirstColumn, line...) + line = line[:0] + } for i < len(line) { j := 0 for j+i < len(line) && line[i+j] == d { @@ -90,3 +95,6 @@ func _putPage(w io.Writer, b []byte, d byte, instances int) error { func lines(b []byte) [][]byte { return bytes.Split(b, []byte{'\n'}) } + +func startOfNextColumn(line []byte, d byte, instances int) (int, { +}