Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for isWordSeparator (0.1 sec)

  1. pkg/util/strcase/camelcase.go

    import (
    	"bytes"
    	"strings"
    )
    
    // CamelCase converts the string into camel case string
    func CamelCase(s string) string {
    	if s == "" {
    		return ""
    	}
    	t := make([]byte, 0, 32)
    	i := 0
    	if isWordSeparator(s[0]) {
    		// Need a capital letter; drop the '_'.
    		t = append(t, 'X')
    		i++
    	}
    	// Invariant: if the next letter is lower case, it must be converted
    	// to upper case.
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri Feb 28 19:48:10 UTC 2020
    - 2.7K bytes
    - Viewed (0)
  2. pkg/util/strcase/camelcase_test.go

    			want: true,
    		},
    		{
    			name: "foo",
    			c:    'f',
    			want: false,
    		},
    	}
    	for _, tt := range tests {
    		t.Run(tt.name, func(t *testing.T) {
    			if got := isWordSeparator(tt.c); got != tt.want {
    				t.Errorf("isWordSeparator() = %v, want %v", got, tt.want)
    			}
    		})
    	}
    }
    
    func Test_isASCIILower(t *testing.T) {
    	tests := []struct {
    		name string
    		c    byte
    		want bool
    	}{
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Oct 31 14:48:28 UTC 2023
    - 3.8K bytes
    - Viewed (0)
Back to top