Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for RTrimSlice (0.09 sec)

  1. utils/utils.go

    func JoinNestedRelationNames(relationNames []string) string {
    	return strings.Join(relationNames, nestedRelationSplit)
    }
    
    // RTrimSlice Right trims the given slice by given length
    func RTrimSlice[T any](v []T, trimLen int) []T {
    	if trimLen >= len(v) { // trimLen greater than slice len means fully sliced
    		return v[:0]
    	}
    	if trimLen < 0 { // negative trimLen is ignored
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Aug 22 11:03:42 UTC 2024
    - 4.1K bytes
    - Viewed (0)
  2. utils/utils_test.go

    			trimLen:  -1,
    			expected: []int{1, 2, 3},
    		},
    	}
    
    	for _, testcase := range tests {
    		t.Run(testcase.name, func(t *testing.T) {
    			result := RTrimSlice(testcase.input, testcase.trimLen)
    			if !AssertEqual(result, testcase.expected) {
    				t.Errorf("RTrimSlice(%v, %d) = %v; want %v", testcase.input, testcase.trimLen, result, testcase.expected)
    			}
    		})
    	}
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Aug 22 11:03:42 UTC 2024
    - 4.9K bytes
    - Viewed (0)
Back to top