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 formatStringInterpolatorV2, list formatListArgs, maxPrecision int)
| 719 | // parseAndFormatClause parses the format clause at the start of the given string with val, and returns |
| 720 | // how many characters were consumed and the substituted string form of val, or an error if one occurred. |
| 721 | func parseAndFormatClauseV2(formatStr string, val ref.Val, callback formatStringInterpolatorV2, list formatListArgs, maxPrecision int) (int, string, error) { |
| 722 | i := 1 |
| 723 | read, formatter, err := parseFormattingClauseV2(formatStr[i:], callback, maxPrecision) |
| 724 | i += read |
| 725 | if err != nil { |
| 726 | return -1, "", newParseFormatError("could not parse formatting clause", err) |
| 727 | } |
| 728 | |
| 729 | valStr, err := formatter(val) |
| 730 | if err != nil { |
| 731 | return -1, "", newParseFormatError("error during formatting", err) |
| 732 | } |
| 733 | return i, valStr, nil |
| 734 | } |
| 735 | |
| 736 | func parseFormattingClauseV2(formatStr string, callback formatStringInterpolatorV2, maxPrecision int) (int, clauseImplV2, error) { |
| 737 | i := 0 |
no test coverage detected