Parse version input¶
This operation turns a dot-delimited string such as "1.2.3.4" into a fully populated Version instance. It backs two entry points: the shared Version.Parse(input) factory method, and the New Version(input) string constructor, which calls Parse internally and copies the result onto the instance being constructed.
| Field | Value |
|---|---|
| Operation ID | OP-VER-001 |
| Trigger | Caller constructs New Version(input) or invokes Version.Parse(input) |
| Inputs | input As String |
| Outputs | New Version instance with Major, Minor, Build, and Revision populated |
| Primary components | Version.New(input As String), Version.Parse(input As String) |
| Entry point | SAIF.Framework.Version\Version.vb |
Steps¶
- If the caller used the string constructor,
New Version(input)delegates immediately toVersion.Parse(input)and applies the returned segments to the new instance. - Split
inputon the.character to produceversionParts. - On failure: if
inputisNothing,String.Splitthrows, and because there is no local guard, the exception propagates unchanged to the caller. - Seed local working variables with the defaults
major = "1",minor = "0",build = "0", andrevision = "0". - Overwrite
majorwithversionParts(0). - If the first token is blank: the blank value replaces the
"1"default, so a leading empty segment is never defaulted — only the trailing segments benefit from the seeded defaults. - Copy
versionParts(1),versionParts(2), andversionParts(3)intominor,build, andrevisionrespectively, but only for indexes that the split actually produced; any index the input omits keeps its seeded"0"value (BR-002). - If
inputcontains more than four dot-separated segments: every token beyond index3is ignored and never surfaces in the result. - Construct
New Version(major, minor, build, revision)and return it to the caller. - If this path was entered from the string constructor: the constructor's internal
Updatestep copies these four segment values onto the instance under construction, so the caller sees a fully initialized object rather than the intermediate result.
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([Caller provides version string]) --> Split[Split input on dot]
Split --> Defaults[Seed local segment defaults]
Defaults --> Major[Overwrite Major with first segment]
Major --> Missing{Trailing segments present?}
Missing -->|Yes| Copy[Copy available trailing segments]
Missing -->|No| Keep[Keep seeded 0 defaults]
Copy --> BuildVersion[Construct new Version instance]
Keep --> BuildVersion
BuildVersion --> EndOk([Return populated Version instance])
Failure and edge-case behavior¶
- A
Nothinginputis not caught locally; the runtime exception fromString.Splitsurfaces directly to the caller. - The
major = "1"seed only matters when the split itself fails to produce a first token, which does not happen for any non-null input; in practice,Majoris always taken verbatim from the first dot-separated segment, blank or not. - Segments beyond the fourth are silently dropped — a five-part input such as
"1.2.3.4.5"parses identically to"1.2.3.4".
Related documentation¶
Sources¶
SAIF.Framework.Version\Version.vb