master
bel 2022-07-26 18:52:33 -06:00
parent d46d4bc272
commit d359005ac9
2 changed files with 9 additions and 0 deletions

1
link Normal file
View File

@ -0,0 +1 @@
https://www.includehelp.com/golang/read-data-from-file-till-specified-character-using-pre-defined-function.aspx

View File

@ -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, {
}