本文整理汇总了Golang中strconv.AppendQuoteRuneToASCII函数的典型用法代码示例。如果您正苦于以下问题:Golang AppendQuoteRuneToASCII函数的具体用法?Golang AppendQuoteRuneToASCII怎么用?Golang AppendQuoteRuneToASCII使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AppendQuoteRuneToASCII函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ExampleAppendQuoteRuneToASCII
func ExampleAppendQuoteRuneToASCII() {
b := []byte("rune (ascii):")
b = strconv.AppendQuoteRuneToASCII(b, '☺')
fmt.Println(string(b))
// Output:
// rune (ascii):'\u263a'
}
示例2: fmt_qc
// fmt_qc formats the integer as a single-quoted, escaped Go character constant.
// If the character is not valid Unicode, it will print '\ufffd'.
func (f *fmt) fmt_qc(c int64) {
var quoted []byte
if f.plus {
quoted = strconv.AppendQuoteRuneToASCII(f.intbuf[0:0], rune(c))
} else {
quoted = strconv.AppendQuoteRune(f.intbuf[0:0], rune(c))
}
f.pad(quoted)
}
示例3: fmt_qc
// fmt_qc formats an integer as a single-quoted, escaped Go character constant.
// If the character is not valid Unicode, it will print '\ufffd'.
func (f *fmt) fmt_qc(c uint64) {
r := rune(c)
if c > utf8.MaxRune {
r = utf8.RuneError
}
buf := f.intbuf[:0]
if f.plus {
f.pad(strconv.AppendQuoteRuneToASCII(buf, r))
} else {
f.pad(strconv.AppendQuoteRune(buf, r))
}
}
示例4: main
func main() {
b := []byte("rune (ascii):")
b = strconv.AppendQuoteRuneToASCII(b, '☺')
fmt.Println(string(b))
}