diff options
| author | Shulhan <ms@kilabit.info> | 2018-09-16 05:37:37 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2018-09-17 22:51:20 +0700 |
| commit | cdcee0eb01305a18b330d2e3c811091fe5164c11 (patch) | |
| tree | 9f6acffa5fb9d29ff041d0c137e39908638af789 /lib/bytes/bytes.go | |
| parent | e914833fa2b0a99fc726c313d594f31ab6b132ba (diff) | |
| download | pakakeh.go-cdcee0eb01305a18b330d2e3c811091fe5164c11.tar.xz | |
Merge package "github.com/shuLhan/tekstus", part 2/3
Diffstat (limited to 'lib/bytes/bytes.go')
| -rw-r--r-- | lib/bytes/bytes.go | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/bytes/bytes.go b/lib/bytes/bytes.go index 7210b746..d9288c7d 100644 --- a/lib/bytes/bytes.go +++ b/lib/bytes/bytes.go @@ -153,10 +153,7 @@ func CutUntilToken(line, token []byte, startAt int, checkEsc bool) ([]byte, int, // If no `leftcap` or `rightcap` is found, it will return line as is, and // status will be false. // -func EncloseRemove(line, leftcap, rightcap []byte) ( - newline []byte, - status bool, -) { +func EncloseRemove(line, leftcap, rightcap []byte) ([]byte, bool) { lidx := TokenFind(line, leftcap, 0) ridx := TokenFind(line, rightcap, lidx+1) @@ -164,14 +161,12 @@ func EncloseRemove(line, leftcap, rightcap []byte) ( return line, false } + var newline []byte newline = append(newline, line[:lidx]...) newline = append(newline, line[ridx+len(rightcap):]...) - status = true - - // Repeat newline, _ = EncloseRemove(newline, leftcap, rightcap) - return + return newline, true } // |
