MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / ParseNumericSuffix

Function ParseNumericSuffix

internal/thinking/suffix.go:66–83  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

64//
65// For special handling of -1 as auto mode, use ParseSpecialSuffix instead.
66func 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//

Callers 1

parseSuffixToConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected