Add ToSliceOfSliceOfStrings method to tag encoder and bump version to v0.10.3
Some checks failed
Go / build (push) Has been cancelled
Some checks failed
Go / build (push) Has been cancelled
This commit is contained in:
@@ -157,6 +157,17 @@ func (t *T) Relay() (key []byte) {
|
||||
return
|
||||
}
|
||||
|
||||
// ToSliceOfStrings returns the tag's bytes slices as a slice of strings. This
|
||||
// method provides a convenient way to access the tag's contents in string format.
|
||||
//
|
||||
// # Return Values
|
||||
//
|
||||
// - s ([]string): A slice containing all tag elements converted to strings.
|
||||
//
|
||||
// # Expected Behaviour
|
||||
//
|
||||
// Returns an empty slice if the tag is empty, otherwise returns a new slice with
|
||||
// each byte slice element converted to a string.
|
||||
func (t *T) ToSliceOfStrings() (s []string) {
|
||||
for _, v := range t.T {
|
||||
s = append(s, string(v))
|
||||
|
||||
@@ -188,3 +188,24 @@ func (s *S) GetTagElement(i int) (t *T) {
|
||||
t = (*s)[i]
|
||||
return
|
||||
}
|
||||
|
||||
// ToSliceOfSliceOfStrings converts the tag collection into a two-dimensional
|
||||
// slice of strings, maintaining the structure of tags and their elements.
|
||||
//
|
||||
// # Return Values
|
||||
//
|
||||
// - ss ([][]string): A slice of string slices where each inner slice represents
|
||||
// a tag's elements converted from bytes to strings.
|
||||
//
|
||||
// - err (error): Currently unused but maintained for interface consistency.
|
||||
//
|
||||
// # Expected Behaviour
|
||||
//
|
||||
// Iterates through each tag in the collection and converts its byte elements
|
||||
// to strings, preserving the tag structure in the resulting nested slice.
|
||||
func (s *S) ToSliceOfSliceOfStrings() (ss [][]string, err error) {
|
||||
for _, v := range *s {
|
||||
ss = append(ss, v.ToSliceOfStrings())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
v0.10.2
|
||||
v0.10.3
|
||||
Reference in New Issue
Block a user