operand-list.go: ToString() now can handle the Truncate option
This commit is contained in:
parent
554ff1a9dd
commit
82ec78719d
@ -27,7 +27,7 @@ func newList(listAny []any) (list *ListType) {
|
||||
return
|
||||
}
|
||||
|
||||
func (ls *ListType) ToString(opt FmtOpt) string {
|
||||
func (ls *ListType) ToString(opt FmtOpt) (s string) {
|
||||
var sb strings.Builder
|
||||
sb.WriteByte('[')
|
||||
if len(*ls) > 0 {
|
||||
@ -55,7 +55,11 @@ func (ls *ListType) ToString(opt FmtOpt) string {
|
||||
}
|
||||
}
|
||||
sb.WriteByte(']')
|
||||
return sb.String()
|
||||
s = sb.String()
|
||||
if opt&Truncate != 0 && len(s) > TruncateSize {
|
||||
s = TruncateString(s)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (ls *ListType) String() string {
|
||||
|
Loading…
Reference in New Issue
Block a user