ParseNumericSuffix attempts to parse a raw suffix as a numeric budget value. This function parses the raw suffix content (from ParseSuffix.RawSuffix) as an integer. Only non-negative integers are considered valid numeric suffixes. Platform note: The budget value uses Go's int type, which is 32-bit
(rawSuffix string)
| 64 | // |
| 65 | // For special handling of -1 as auto mode, use ParseSpecialSuffix instead. |
| 66 | func ParseNumericSuffix(rawSuffix string) (budget int, ok bool) { |
| 67 | if rawSuffix == "" { |
| 68 | return 0, false |
| 69 | } |
| 70 | |
| 71 | value, err := strconv.Atoi(rawSuffix) |
| 72 | if err != nil { |
| 73 | return 0, false |
| 74 | } |
| 75 | |
| 76 | // Negative numbers are not valid numeric suffixes |
| 77 | // -1 should be handled by special value parsing as "auto" |
| 78 | if value < 0 { |
| 79 | return 0, false |
| 80 | } |
| 81 | |
| 82 | return value, true |
| 83 | } |
| 84 | |
| 85 | // ParseSpecialSuffix attempts to parse a raw suffix as a special thinking mode value. |
| 86 | // |
no outgoing calls
no test coverage detected