Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 31 for Split (0.22 sec)

  1. src/bufio/example_test.go

    	// Set the split function for the scanning operation.
    	scanner.Split(bufio.ScanWords)
    	// Count the words.
    	count := 0
    	for scanner.Scan() {
    		count++
    	}
    	if err := scanner.Err(); err != nil {
    		fmt.Fprintln(os.Stderr, "reading input:", err)
    	}
    	fmt.Printf("%d\n", count)
    	// Output: 15
    }
    
    // Use a Scanner with a custom split function (built by wrapping ScanWords) to validate
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Oct 23 09:06:30 GMT 2023
    - 4.9K bytes
    - Viewed (0)
  2. src/bufio/scan.go

    	s.maxTokenSize = max
    }
    
    // Split sets the split function for the [Scanner].
    // The default split function is [ScanLines].
    //
    // Split panics if it is called after scanning has started.
    func (s *Scanner) Split(split SplitFunc) {
    	if s.scanCalled {
    		panic("Split called after Scan")
    	}
    	s.split = split
    }
    
    // Split functions
    
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Oct 23 09:06:30 GMT 2023
    - 14.2K bytes
    - Viewed (0)
  3. src/archive/zip/reader.go

    			}
    		}
    
    		sort.Slice(r.fileList, func(i, j int) bool { return fileEntryLess(r.fileList[i].name, r.fileList[j].name) })
    	})
    }
    
    func fileEntryLess(x, y string) bool {
    	xdir, xelem, _ := split(x)
    	ydir, yelem, _ := split(y)
    	return xdir < ydir || xdir == ydir && xelem < yelem
    }
    
    // Open opens the named file in the ZIP archive,
    // using the semantics of fs.FS.Open:
    // paths are always slash separated, with no
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Oct 13 18:36:46 GMT 2023
    - 27.7K bytes
    - Viewed (0)
  4. src/cmd/addr2line/addr2line_test.go

    	if err != nil {
    		t.Fatalf("go tool addr2line %v: %v\n%s", os.Args[0], err, string(out))
    	}
    	f := strings.Split(string(out), "\n")
    	if len(f) < 3 && f[2] == "" {
    		t.Fatal("addr2line output must have 2 lines")
    	}
    	funcname = f[0]
    	pathAndLineNo := f[1]
    	f = strings.Split(pathAndLineNo, ":")
    	if runtime.GOOS == "windows" && len(f) == 3 {
    		// Reattach drive letter.
    		f = []string{f[0] + ":" + f[1], f[2]}
    	}
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Wed Feb 21 22:16:54 GMT 2024
    - 3.8K bytes
    - Viewed (0)
  5. src/bytes/example_test.go

    	// U+0068 'h'
    	// U+0065 'e'
    	// U+0072 'r'
    }
    
    func ExampleSplit() {
    	fmt.Printf("%q\n", bytes.Split([]byte("a,b,c"), []byte(",")))
    	fmt.Printf("%q\n", bytes.Split([]byte("a man a plan a canal panama"), []byte("a ")))
    	fmt.Printf("%q\n", bytes.Split([]byte(" xyz "), []byte("")))
    	fmt.Printf("%q\n", bytes.Split([]byte(""), []byte("Bernardo O'Higgins")))
    	// Output:
    	// ["a" "b" "c"]
    	// ["" "man " "plan " "canal panama"]
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Mar 04 15:54:40 GMT 2024
    - 15K bytes
    - Viewed (1)
  6. src/bytes/bytes_test.go

    		}
    
    		s := Join(a, []byte(tt.sep))
    		if string(s) != tt.s {
    			t.Errorf(`Join(Split(%q, %q, %d), %q) = %q`, tt.s, tt.sep, tt.n, tt.sep, s)
    		}
    		if tt.n < 0 {
    			b := Split([]byte(tt.s), []byte(tt.sep))
    			if !reflect.DeepEqual(a, b) {
    				t.Errorf("Split disagrees withSplitN(%q, %q, %d) = %v; want %v", tt.s, tt.sep, tt.n, b, a)
    			}
    		}
    		if len(a) > 0 {
    			in, out := a[0], s
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Wed Jan 24 16:07:25 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  7. src/cmd/asm/internal/asm/pseudo_test.go

    package asm
    
    import (
    	"strings"
    	"testing"
    
    	"cmd/asm/internal/lex"
    )
    
    func tokenize(s string) [][]lex.Token {
    	res := [][]lex.Token{}
    	if len(s) == 0 {
    		return res
    	}
    	for _, o := range strings.Split(s, ",") {
    		res = append(res, lex.Tokenize(o))
    	}
    	return res
    }
    
    func TestErroneous(t *testing.T) {
    
    	type errtest struct {
    		pseudo   string
    		operands string
    		expected string
    	}
    
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Tue Aug 29 07:48:38 GMT 2023
    - 3.1K bytes
    - Viewed (0)
  8. src/cmd/cgo/internal/swig/swig_test.go

    	// Ask the go tool for the CXX it's configured to use.
    	cxx, err := exec.Command("go", "env", "CXX").CombinedOutput()
    	if err != nil {
    		t.Fatalf("go env CXX failed: %s", err)
    	}
    	args, err := quoted.Split(string(cxx))
    	if err != nil {
    		t.Skipf("could not parse 'go env CXX' output %q: %s", string(cxx), err)
    	}
    	if len(args) == 0 {
    		t.Skip("no C++ compiler")
    	}
    	testenv.MustHaveExecPath(t, string(args[0]))
    }
    
    Go
    - Registered: Tue Apr 23 11:13:09 GMT 2024
    - Last Modified: Fri May 12 12:00:07 GMT 2023
    - 3.7K bytes
    - Viewed (0)
  9. src/cmd/api/api_test.go

    				fmt.Fprintf(f, "%s\n", feat)
    			}
    			f.Close()
    		}
    
    		bs, err := os.ReadFile(goldenFile)
    		if err != nil {
    			t.Fatalf("opening golden.txt for package %q: %v", fi.Name(), err)
    		}
    		wanted := strings.Split(string(bs), "\n")
    		sort.Strings(wanted)
    		for _, feature := range wanted {
    			if feature == "" {
    				continue
    			}
    			_, ok := w.features[feature]
    			if !ok {
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Thu Jan 04 17:31:12 GMT 2024
    - 7.1K bytes
    - Viewed (0)
  10. src/cmd/asm/internal/asm/endtoend_test.go

    		failed = true
    		t.Errorf(format, args...)
    	}
    	pList.Firstpc, ok = parser.Parse()
    	if !ok || failed {
    		t.Errorf("asm: %s assembly failed", goarch)
    		return
    	}
    	output := strings.Split(testOut.String(), "\n")
    
    	// Reconstruct expected output by independently "parsing" the input.
    	data, err := os.ReadFile(input)
    	if err != nil {
    		t.Error(err)
    		return
    	}
    	lineno := 0
    	seq := 0
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Thu Dec 07 18:42:59 GMT 2023
    - 11.6K bytes
    - Viewed (0)
Back to top