// convertString returns the string represented by the next input characters.
// The format of the input is determined by the verb.
func (s *ss) convertString(verb rune) (str string) {
- if !s.okVerb(verb, "svqx", "string") {
+ if !s.okVerb(verb, "svqxX", "string") {
return ""
}
s.skipSpace(false)
switch verb {
case 'q':
str = s.quotedString()
- case 'x':
+ case 'x', 'X':
str = s.hexString()
default:
str = string(s.token(true, notSpace)) // %s and %v just return the next word
// Strings
{"%s", "using-%s\n", &stringVal, "using-%s"},
{"%x", "7573696e672d2578\n", &stringVal, "using-%x"},
+ {"%X", "7573696E672D2558\n", &stringVal, "using-%X"},
{"%q", `"quoted\twith\\do\u0075bl\x65s"` + "\n", &stringVal, "quoted\twith\\doubles"},
{"%q", "`quoted with backs`\n", &stringVal, "quoted with backs"},
// Byte slices
{"%s", "bytes-%s\n", &bytesVal, []byte("bytes-%s")},
{"%x", "62797465732d2578\n", &bytesVal, []byte("bytes-%x")},
+ {"%X", "62797465732D2558\n", &bytesVal, []byte("bytes-%X")},
{"%q", `"bytes\rwith\vdo\u0075bl\x65s"` + "\n", &bytesVal, []byte("bytes\rwith\vdoubles")},
{"%q", "`bytes with backs`\n", &bytesVal, []byte("bytes with backs")},