AlphaCol2Int Function |
Unit
QESBPCSConvert
Declaration
Function AlphaCol2Int(const AlphaCol: string): Word;
Description
Only at most 2 characters processed.
Parameters |
AlphaCol | Alphabetic Column Heading like 'A' or 'BC' |
Returns
Numeric Column, where first column 'A' is 1
Category
String/Integer Conversion RoutinesImplementation
function AlphaCol2Int (const AlphaCol: string): Word; var LA: Integer; S: string; begin S := UpperCase (AlphaCol); LA := Length (S); if LA = 0 then Result := 0 else if LA = 1 then Result := Ord (S [1]) - 64 else Result := (Ord (S [1]) - 64) * 26 + Ord (S [2]) - 64; End; |
|