Skip to content

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

  1. The numeric digit arrives through IConverter.ConvertNumericToAlpha.
  2. The call dispatches to whichever converter implementation is active.
  3. ConverterBase returns input.ToString() with no base-specific validation — any integer value is accepted as-is.
  4. HexConverter first rejects values greater than 16 by raising ConverterException, then maps 10-15 to A-F; every other accepted value is returned as its decimal string (BR-001).
  5. ExcelConverter first rejects values greater than 26 by raising ConverterException, then converts the accepted value to a letter with Chr(64 + input).ToString (BR-002).
  6. In a full Excel encode workflow, this operation's raw output is not the final string — FormatBaseN still 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

  • ConverterBase never validates that the supplied digit fits the converter's base; it always returns the decimal string form regardless of magnitude.
  • HexConverter throws ConverterException when the supplied value exceeds 16 (BR-001).
  • ExcelConverter throws ConverterException when the supplied value exceeds 26 (BR-002).
  • Calling ExcelConverter.ConvertNumericToAlpha(0) directly renders @, an artifact of the raw Chr(64 + input) mapping. The standard encode flow never exposes this artifact to callers because FormatBaseN rewrites zero digits before the string is finalized (BR-003).

Sources

  • SAIF.Framework.BaseN\ConverterBase.vb
  • SAIF.Framework.BaseN\HexConverter.vb
  • SAIF.Framework.BaseN\ExcelConverter.vb