GO語言"strconv"包中"QuoteRuneToGraphic"函數的用法及代碼示例。
用法:
func QuoteRuneToGraphic(r rune) string
QuoteRuneToGraphic 返回表示符文的單引號 Go 字符文字。如果符文不是由IsGraphic 定義的Unicode 圖形字符,則返回的字符串將使用Go 轉義序列(\t、\n、\xFF、\u0100)。
例子:
package main
import (
"fmt"
"strconv"
)
func main() {
s := strconv.QuoteRuneToGraphic('☺')
fmt.Println(s)
s = strconv.QuoteRuneToGraphic('\u263a')
fmt.Println(s)
s = strconv.QuoteRuneToGraphic('\u000a')
fmt.Println(s)
s = strconv.QuoteRuneToGraphic(' ') // tab character
fmt.Println(s)
}
輸出:
'☺' '☺' '\n' '\t'
相關用法
- GO QuoteRuneToASCII用法及代碼示例
- GO QuoteRune用法及代碼示例
- GO QuoteToGraphic用法及代碼示例
- GO Quote用法及代碼示例
- GO QuoteMeta用法及代碼示例
- GO QuoteToASCII用法及代碼示例
- GO QueryEscape用法及代碼示例
- GO QueryUnescape用法及代碼示例
- GO PutUvarint用法及代碼示例
- GO Scanner.Scan用法及代碼示例
- GO LeadingZeros32用法及代碼示例
- GO NewFromFiles用法及代碼示例
- GO Regexp.FindString用法及代碼示例
- GO Time.Sub用法及代碼示例
- GO Regexp.FindAllIndex用法及代碼示例
- GO Encode用法及代碼示例
- GO ResponseRecorder用法及代碼示例
- GO Value用法及代碼示例
- GO StreamWriter用法及代碼示例
- GO Fscanln用法及代碼示例
注:本文由純淨天空篩選整理自golang.google.cn大神的英文原創作品 QuoteRuneToGraphic。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。