hold
parent
d46d4bc272
commit
d359005ac9
|
|
@ -0,0 +1 @@
|
|||
https://www.includehelp.com/golang/read-data-from-file-till-specified-character-using-pre-defined-function.aspx
|
||||
8
main.go
8
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, {
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue