Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for FieldsFunc (0.14 sec)

  1. src/bytes/iter.go

    		}
    	}
    }
    
    // FieldsFuncSeq returns an iterator over substrings of s split around runs of
    // Unicode code points satisfying f(c).
    // The iterator yields the same strings that would be returned by FieldsFunc(s),
    // but without constructing the slice.
    func FieldsFuncSeq(s []byte, f func(rune) bool) iter.Seq[[]byte] {
    	return func(yield func([]byte) bool) {
    		start := -1
    		for i := 0; i < len(s); {
    			size := 1
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Wed Aug 14 18:23:13 UTC 2024
    - 3.7K bytes
    - Viewed (0)
  2. utils/utils_test.go

    	"errors"
    	"math"
    	"strings"
    	"testing"
    	"time"
    )
    
    func TestIsValidDBNameChar(t *testing.T) {
    	for _, db := range []string{"db", "dbName", "db_name", "db1", "1dbname", "db$name"} {
    		if fields := strings.FieldsFunc(db, IsValidDBNameChar); len(fields) != 1 {
    			t.Fatalf("failed to parse db name %v", db)
    		}
    	}
    }
    
    func TestCheckTruth(t *testing.T) {
    	checkTruthTests := []struct {
    		v   string
    		out bool
    	}{
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Aug 22 11:03:42 UTC 2024
    - 4.9K bytes
    - Viewed (0)
  3. chainable_api.go

    func (db *DB) Omit(columns ...string) (tx *DB) {
    	tx = db.getInstance()
    
    	if len(columns) == 1 && strings.ContainsRune(columns[0], ',') {
    		tx.Statement.Omits = strings.FieldsFunc(columns[0], utils.IsValidDBNameChar)
    	} else {
    		tx.Statement.Omits = columns
    	}
    	return
    }
    
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Mon Jun 24 09:42:59 UTC 2024
    - 14.8K bytes
    - Viewed (0)
  4. finisher_api.go

    		expr := clause.Expr{SQL: "count(*)"}
    
    		if len(tx.Statement.Selects) == 1 {
    			dbName := tx.Statement.Selects[0]
    			fields := strings.FieldsFunc(dbName, utils.IsValidDBNameChar)
    			if len(fields) == 1 || (len(fields) == 3 && (strings.ToUpper(fields[1]) == "AS" || fields[1] == ".")) {
    				if tx.Statement.Parse(tx.Statement.Model) == nil {
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Sat Sep 14 12:58:29 UTC 2024
    - 22.8K bytes
    - Viewed (0)
  5. src/bytes/bytes.go

    		a[na] = s[fieldStart:len(s):len(s)]
    	}
    	return a
    }
    
    // FieldsFunc interprets s as a sequence of UTF-8-encoded code points.
    // It splits the slice s at each run of code points c satisfying f(c) and
    // returns a slice of subslices of s. If all code points in s satisfy f(c), or
    // len(s) == 0, an empty slice is returned.
    //
    // FieldsFunc makes no guarantees about the order in which it calls f(c)
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Tue Sep 03 20:55:15 UTC 2024
    - 35.6K bytes
    - Viewed (0)
  6. src/bytes/bytes_test.go

    			}
    		}
    	}
    }
    
    func TestFieldsFunc(t *testing.T) {
    	for _, tt := range fieldstests {
    		a := FieldsFunc([]byte(tt.s), unicode.IsSpace)
    		result := sliceOfString(a)
    		if !slices.Equal(result, tt.a) {
    			t.Errorf("FieldsFunc(%q, unicode.IsSpace) = %v; want %v", tt.s, a, tt.a)
    			continue
    		}
    	}
    	pred := func(c rune) bool { return c == 'X' }
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Mon Aug 19 19:09:04 UTC 2024
    - 61.2K bytes
    - Viewed (0)
  7. src/bytes/example_test.go

    	// Output: Fields are: ["foo" "bar" "baz"]
    }
    
    func ExampleFieldsFunc() {
    	f := func(c rune) bool {
    		return !unicode.IsLetter(c) && !unicode.IsNumber(c)
    	}
    	fmt.Printf("Fields are: %q", bytes.FieldsFunc([]byte("  foo1;bar2,baz3..."), f))
    	// Output: Fields are: ["foo1" "bar2" "baz3"]
    }
    
    func ExampleHasPrefix() {
    	fmt.Println(bytes.HasPrefix([]byte("Gopher"), []byte("Go")))
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Wed Aug 07 17:22:36 UTC 2024
    - 14.9K bytes
    - Viewed (0)
  8. api/go1.txt

    pkg bytes, func Count([]uint8, []uint8) int
    pkg bytes, func Equal([]uint8, []uint8) bool
    pkg bytes, func EqualFold([]uint8, []uint8) bool
    pkg bytes, func Fields([]uint8) [][]uint8
    pkg bytes, func FieldsFunc([]uint8, func(int32) bool) [][]uint8
    pkg bytes, func HasPrefix([]uint8, []uint8) bool
    pkg bytes, func HasSuffix([]uint8, []uint8) bool
    pkg bytes, func Index([]uint8, []uint8) int
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Wed Aug 14 18:58:28 UTC 2013
    - 1.7M bytes
    - Viewed (0)
Back to top