github.com/haraldrudell/parl@v0.4.176/g0/shorts.go (about)

     1  /*
     2  © 2023–present Harald Rudell <harald.rudell@gmail.com> (https://haraldrudell.github.io/haraldrudell/)
     3  ISC License
     4  */
     5  
     6  package g0
     7  
     8  import (
     9  	"strconv"
    10  	"strings"
    11  
    12  	"github.com/haraldrudell/parl"
    13  )
    14  
    15  // Shorts retruns a string of Short descriptions of all threads in the slice
    16  //   - string is never empty
    17  func Shorts(threads []parl.ThreadData) (s string) {
    18  	length := len(threads)
    19  	s = "threads:" + strconv.Itoa(length)
    20  	if length > 0 {
    21  		sList := make([]string, length)
    22  		for i, t := range threads {
    23  			sList[i] = t.Short()
    24  		}
    25  		s += "[" + strings.Join(sList, ",") + "]"
    26  	}
    27  	return
    28  }