Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for CopyStrings (0.3 sec)

  1. pkg/util/slice/slice_test.go

    	var src1 []string
    	dest1 := CopyStrings(src1)
    
    	if !reflect.DeepEqual(src1, dest1) {
    		t.Errorf("%v and %v are not equal", src1, dest1)
    	}
    
    	src2 := []string{}
    	dest2 := CopyStrings(src2)
    
    	if !reflect.DeepEqual(src2, dest2) {
    		t.Errorf("%v and %v are not equal", src2, dest2)
    	}
    
    	src3 := []string{"a", "c", "b"}
    	dest3 := CopyStrings(src3)
    
    	if !reflect.DeepEqual(src3, dest3) {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Jun 30 07:21:37 UTC 2022
    - 3.5K bytes
    - Viewed (0)
  2. pkg/util/slice/slice.go

    limitations under the License.
    */
    
    // Package slice provides utility methods for common operations on slices.
    package slice
    
    import (
    	"sort"
    )
    
    // CopyStrings copies the contents of the specified string slice
    // into a new slice.
    func CopyStrings(s []string) []string {
    	if s == nil {
    		return nil
    	}
    	c := make([]string, len(s))
    	copy(c, s)
    	return c
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Aug 21 19:03:53 UTC 2019
    - 2.1K bytes
    - Viewed (0)
Back to top