Extensions¶
Extensions is a public module providing a single string extension method, ToInt, used internally by Version to normalize a version segment string into an integer for comparison purposes.
Purpose¶
- Coerce a version segment string's leading digit run to an integer, treating non-numeric or conversion-failing input as
0, so thatVersioncomparisons operate on numeric rather than string values.
Context¶
- Namespace:
SAIF.Framework.Version - Assembly/package:
SAIF.Framework.Version
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| ToInt | Public Function ToInt(value As String) As Integer (extension method on String) |
Extracts and converts the leading numeric portion of value to an Integer; returns 0 if value does not start with digits or if conversion otherwise fails. See BR-001. |
Behavioral notes¶
ToIntwraps its conversion logic in aTry/Catchwith an emptyCatchblock, silently swallowing any conversion exception and returning0rather than propagating the error.* See BR-001.- This method is used exclusively by
Version's comparison operators andCompareToto normalizeMajor,Minor,Build, andRevisionsegment values before comparing them numerically.*
Constraints and usage notes¶
ToIntrequires theSystem.Text.RegularExpressionsnamespace to be imported for its leading-digit extraction logic.- Because conversion failures are silently coerced to
0, callers should not rely onToIntto detect or surface malformed numeric input.
Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.
Sources¶
SAIF.Framework.Version\Version.vb