Lines Matching refs:Format
37 // the flags and options for the operand's format specifier.
51 // The implementation of Format may call Sprint(f) or Fprint(f) etc.
54 Format(f State, c rune)
58 // which defines the ``native'' format for that value.
60 // to any format that accepts a string or to an unformatted printer
69 // to a %#v format.
114 // fmt is used to format basic items such as integers or strings.
117 // reordered records whether the format string used argument reordering.
175 // These routines end in 'f' and take a format string.
177 // Fprintf formats according to a format specifier and writes to w.
179 func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {
181 p.doPrintf(format, a)
187 // Printf formats according to a format specifier and writes to standard output.
189 func Printf(format string, a ...interface{}) (n int, err error) {
190 return Fprintf(os.Stdout, format, a...)
193 // Sprintf formats according to a format specifier and returns the resulting string.
194 func Sprintf(format string, a ...interface{}) string {
196 p.doPrintf(format, a)
202 // Errorf formats according to a format specifier and returns the string
204 func Errorf(format string, a ...interface{}) error {
205 return errors.New(Sprintf(format, a...))
208 // These routines do not take a format string
238 // These routines end in 'ln', do not take a format string,
563 formatter.Format(p, verb)
577 // If a string is acceptable according to the format, see if
895 // The opening bracket is known to be present at format[0].
899 func parseArgNumber(format string) (index int, wid int, ok bool) {
901 if len(format) < 3 {
906 for i := 1; i < len(format); i++ {
907 if format[i] == ']' {
908 width, ok, newi := parsenum(format, 1, i)
919 // argNum or the value of the bracketed integer that begins format[i:]. It also returns
920 // the new value of i, that is, the index of the next byte of the format to process.
921 func (p *pp) argNumber(argNum int, format string, i int, numArgs int) (newArgNum, newi int, found bool) {
922 if len(format) <= i || format[i] != '[' {
926 index, wid, ok := parseArgNumber(format[i:])
946 func (p *pp) doPrintf(format string, a []interface{}) {
947 end := len(format)
948 argNum := 0 // we process one argument per non-trivial format
949 afterIndex := false // previous item in format was an index like [3].
955 for i < end && format[i] != '%' {
959 p.buf.WriteString(format[lasti:i])
962 // done processing format string
973 c := format[i]
1003 // Format is more complex than simple flags and a verb or is malformed.
1009 argNum, i, afterIndex = p.argNumber(argNum, format, i, len(a))
1012 if i < end && format[i] == '*' {
1029 p.fmt.wid, p.fmt.widPresent, i = parsenum(format, i, end)
1036 if i+1 < end && format[i] == '.' {
1041 argNum, i, afterIndex = p.argNumber(argNum, format, i, len(a))
1042 if i < end && format[i] == '*' {
1055 p.fmt.prec, p.fmt.precPresent, i = parsenum(format, i, end)
1064 argNum, i, afterIndex = p.argNumber(argNum, format, i, len(a))
1072 verb, w := utf8.DecodeRuneInString(format[i:])