Convert numeric digit to alpha representation¶
This operation maps one numeric digit to the string token the active converter renders. The base implementation returns the plain decimal string; the hex and Excel converters substitute alphabetic digits in its place and enforce their own upper-bound checks before doing so.
| Field | Value |
|---|---|
| Operation ID | OP-BASEN-005 |
| Trigger | Converter digit-rendering request |
| Inputs | Integer digit value |
| Outputs | String token |
| Primary components | ConverterBase.ConvertNumericToAlpha, HexConverter.ConvertNumericToAlpha, ExcelConverter.ConvertNumericToAlpha |
| Entry point | SAIF.Framework.BaseN\ConverterBase.vb |
Steps¶
- The numeric digit arrives through
IConverter.ConvertNumericToAlpha. - The call dispatches to whichever converter implementation is active.
ConverterBasereturnsinput.ToString()with no base-specific validation — any integer value is accepted as-is.HexConverterfirst rejects values greater than16by raisingConverterException, then maps10-15toA-F; every other accepted value is returned as its decimal string (BR-001).ExcelConverterfirst rejects values greater than26by raisingConverterException, then converts the accepted value to a letter withChr(64 + input).ToString(BR-002).- In a full Excel encode workflow, this operation's raw output is not the final string —
FormatBaseNstill has to rewrite any zero digit before the value reaches the caller in valid bijective spreadsheet-column form (BR-003).
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start([ConvertNumericToAlpha called]) --> D1{Converter type}
D1 -->|Base/Binary/Octal| S1[Return decimal string]
D1 -->|Hex| S2[Validate upper bound and map A-F]
D1 -->|Excel| S3[Validate upper bound and map A-Z]
S1 --> EndOk([Return token])
S2 --> D2{Value > 16?}
D2 -->|Yes| EndErr([Raise ConverterException])
D2 -->|No| EndOk
S3 --> D3{Value > 26?}
D3 -->|Yes| EndErr
D3 -->|No| EndOk
Failure and edge-case behavior¶
ConverterBasenever validates that the supplied digit fits the converter's base; it always returns the decimal string form regardless of magnitude.HexConverterthrowsConverterExceptionwhen the supplied value exceeds16(BR-001).ExcelConverterthrowsConverterExceptionwhen the supplied value exceeds26(BR-002).- Calling
ExcelConverter.ConvertNumericToAlpha(0)directly renders@, an artifact of the rawChr(64 + input)mapping. The standard encode flow never exposes this artifact to callers becauseFormatBaseNrewrites zero digits before the string is finalized (BR-003).
Related documentation¶
Sources¶
SAIF.Framework.BaseN\ConverterBase.vbSAIF.Framework.BaseN\HexConverter.vbSAIF.Framework.BaseN\ExcelConverter.vb