parseAndFormatClause parses the format clause at the start of the given string with val, and returns how many characters were consumed and the substituted string form of val, or an error if one occurred.
(formatStr string, val ref.Val, callback formatStringInterpolator, list formatListArgs, locale string, maxPrecision int)
| 829 | // parseAndFormatClause parses the format clause at the start of the given string with val, and returns |
| 830 | // how many characters were consumed and the substituted string form of val, or an error if one occurred. |
| 831 | func parseAndFormatClause(formatStr string, val ref.Val, callback formatStringInterpolator, list formatListArgs, locale string, maxPrecision int) (int, string, error) { |
| 832 | i := 1 |
| 833 | read, formatter, err := parseFormattingClause(formatStr[i:], callback, maxPrecision) |
| 834 | i += read |
| 835 | if err != nil { |
| 836 | return -1, "", newParseFormatError("could not parse formatting clause", err) |
| 837 | } |
| 838 | |
| 839 | valStr, err := formatter(val, locale) |
| 840 | if err != nil { |
| 841 | return -1, "", newParseFormatError("error during formatting", err) |
| 842 | } |
| 843 | return i, valStr, nil |
| 844 | } |
| 845 | |
| 846 | func parseFormattingClause(formatStr string, callback formatStringInterpolator, maxPrecision int) (int, clauseImpl, error) { |
| 847 | i := 0 |
no test coverage detected