Flags # and + are not implemented.
The familiar base-setting prefixes 0 (octal) and 0x
- (hexadecimal) are accepted when scanning integers without a
- format or with the %v verb.
-
- Width is interpreted in the input text (%5s means at most
- five runes of input will be read to scan a string) but there
- is no syntax for scanning with a precision (no %5.2f, just
- %5f).
+ (hexadecimal) are accepted when scanning integers without
+ a format or with the %v verb.
+
+ Width is interpreted in the input text but there is no
+ syntax for scanning with a precision (no %5.2f, just %5f).
+ If width is provided, it applies after leading spaces are
+ trimmed and specifies the maximum number of runes to read
+ to satisfy the verb. For example,
+ Sscanf(" 1234567 ", "%5s%d", &s, &i)
+ will set s to "12345" and i to 67 while
+ Sscanf(" 12 34 567 ", "%5s%d", &s, &i)
+ will set s to "12" and i to 34.
In all the scanning functions, a carriage return followed
immediately by a newline is treated as a plain newline
{"%6vX=%3fY", "3+2iX=2.5Y", args(&c, &f), args((3 + 2i), 2.5), ""},
{"%d%s", "123abc", args(&i, &s), args(123, "abc"), ""},
{"%c%c%c", "2\u50c2X", args(&r1, &r2, &r3), args('2', '\u50c2', 'X'), ""},
+ {"%5s%d", " 1234567 ", args(&s, &i), args("12345", 67), ""},
+ {"%5s%d", " 12 34 567 ", args(&s, &i), args("12", 34), ""},
// Custom scanners.
{"%e%f", "eefffff", args(&x, &y), args(Xs("ee"), Xs("fffff")), ""},