Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 9 of 9 for CanBackquote (0.43 sec)

  1. src/strconv/strconv_test.go

    	}))
    	t.Run("ParseComplex", checkNoAllocs(func() {
    		Sink.Complex128, Sink.Error = ParseComplex(string(bytes.Number), 128)
    	}))
    	t.Run("CanBackquote", checkNoAllocs(func() {
    		Sink.Bool = CanBackquote(string(bytes.String))
    	}))
    	t.Run("AppendQuote", checkNoAllocs(func() {
    		Sink.Bytes = AppendQuote(bytes.Buffer[:0], string(bytes.String))
    	}))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Aug 23 20:29:22 UTC 2022
    - 4.7K bytes
    - Viewed (0)
  2. src/strconv/example_test.go

    	if s, err := strconv.Atoi(v); err == nil {
    		fmt.Printf("%T, %v", s, s)
    	}
    
    	// Output:
    	// int, 10
    }
    
    func ExampleCanBackquote() {
    	fmt.Println(strconv.CanBackquote("Fran & Freddie's Diner ☺"))
    	fmt.Println(strconv.CanBackquote("`can't backquote this`"))
    
    	// Output:
    	// true
    	// false
    }
    
    func ExampleFormatBool() {
    	v := true
    	s := strconv.FormatBool(v)
    	fmt.Printf("%T, %v\n", s, s)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 13 22:57:37 UTC 2023
    - 8.9K bytes
    - Viewed (0)
  3. src/strconv/quote_test.go

    	{"a\xe0\xa0z", false},
    	{"\ufeffabc", false},
    	{"a\ufeffz", false},
    }
    
    func TestCanBackquote(t *testing.T) {
    	for _, tt := range canbackquotetests {
    		if out := CanBackquote(tt.in); out != tt.out {
    			t.Errorf("CanBackquote(%q) = %v, want %v", tt.in, out, tt.out)
    		}
    	}
    }
    
    type unQuoteTest struct {
    	in  string
    	out string
    }
    
    var unquotetests = []unQuoteTest{
    	{`""`, ""},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 31 20:37:15 UTC 2022
    - 9.6K bytes
    - Viewed (0)
  4. src/strconv/quote.go

    func AppendQuoteRuneToGraphic(dst []byte, r rune) []byte {
    	return appendQuotedRuneWith(dst, r, '\'', false, true)
    }
    
    // CanBackquote reports whether the string s can be represented
    // unchanged as a single-line backquoted string without control
    // characters other than tab.
    func CanBackquote(s string) bool {
    	for len(s) > 0 {
    		r, wid := utf8.DecodeRuneInString(s)
    		s = s[wid:]
    		if wid > 1 {
    			if r == '\ufeff' {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 04 14:21:28 UTC 2024
    - 16.5K bytes
    - Viewed (0)
  5. src/fmt/format.go

    // If f.sharp is set a raw (backquoted) string may be returned instead
    // if the string does not contain any control characters other than tab.
    func (f *fmt) fmtQ(s string) {
    	s = f.truncateString(s)
    	if f.sharp && strconv.CanBackquote(s) {
    		f.padString("`" + s + "`")
    		return
    	}
    	buf := f.intbuf[:0]
    	if f.plus {
    		f.pad(strconv.AppendQuoteToASCII(buf, s))
    	} else {
    		f.pad(strconv.AppendQuote(buf, s))
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 04 17:31:55 UTC 2024
    - 13.8K bytes
    - Viewed (0)
  6. src/fmt/doc.go

    	'#'	alternate format: add leading 0b for binary (%#b), 0 for octal (%#o),
    		0x or 0X for hex (%#x or %#X); suppress 0x for %p (%#p);
    		for %q, print a raw (backquoted) string if [strconv.CanBackquote]
    		returns true;
    		always print a decimal point for %e, %E, %f, %F, %g and %G;
    		do not remove trailing zeros for %g and %G;
    		write e.g. U+0078 'x' if the character is printable for %U (%#U)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 21:56:20 UTC 2024
    - 14.6K bytes
    - Viewed (0)
  7. src/regexp/regexp.go

    	regexp, err := CompilePOSIX(str)
    	if err != nil {
    		panic(`regexp: CompilePOSIX(` + quote(str) + `): ` + err.Error())
    	}
    	return regexp
    }
    
    func quote(s string) string {
    	if strconv.CanBackquote(s) {
    		return "`" + s + "`"
    	}
    	return strconv.Quote(s)
    }
    
    // NumSubexp returns the number of parenthesized subexpressions in this [Regexp].
    func (re *Regexp) NumSubexp() int {
    	return re.numSubexp
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 26 20:50:01 UTC 2024
    - 38.5K bytes
    - Viewed (0)
  8. src/cmd/vendor/golang.org/x/tools/internal/stdlib/manifest.go

    		{"AppendQuoteRuneToASCII", Func, 0},
    		{"AppendQuoteRuneToGraphic", Func, 6},
    		{"AppendQuoteToASCII", Func, 0},
    		{"AppendQuoteToGraphic", Func, 6},
    		{"AppendUint", Func, 0},
    		{"Atoi", Func, 0},
    		{"CanBackquote", Func, 0},
    		{"ErrRange", Var, 0},
    		{"ErrSyntax", Var, 0},
    		{"FormatBool", Func, 0},
    		{"FormatComplex", Func, 15},
    		{"FormatFloat", Func, 0},
    		{"FormatInt", Func, 0},
    		{"FormatUint", Func, 0},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 534.2K bytes
    - Viewed (0)
  9. api/go1.txt

    pkg strconv, func AppendQuoteToASCII([]uint8, string) []uint8
    pkg strconv, func AppendUint([]uint8, uint64, int) []uint8
    pkg strconv, func Atoi(string) (int, error)
    pkg strconv, func CanBackquote(string) bool
    pkg strconv, func FormatBool(bool) string
    pkg strconv, func FormatFloat(float64, uint8, int, int) string
    pkg strconv, func FormatInt(int64, int) string
    pkg strconv, func FormatUint(uint64, int) string
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Aug 14 18:58:28 UTC 2013
    - 1.7M bytes
    - Viewed (0)
Back to top