MCPcopy
hub / github.com/handsontable/handsontable / spreadsheetColumnLabel

Function spreadsheetColumnLabel

handsontable/src/helpers/data.ts:13–25  ·  view source on GitHub ↗
(index: number)

Source from the content-addressed store, hash-verified

11 * @returns {string}
12 */
13export function spreadsheetColumnLabel(index: number): string {
14 let dividend = index + 1;
15 let columnLabel = '';
16 let modulo;
17
18 while (dividend > 0) {
19 modulo = (dividend - 1) % COLUMN_LABEL_BASE_LENGTH;
20 columnLabel = String.fromCharCode(65 + modulo) + columnLabel;
21 dividend = parseInt(String((dividend - modulo) / COLUMN_LABEL_BASE_LENGTH), 10);
22 }
23
24 return columnLabel;
25}
26
27/**
28 * Generates spreadsheet-like column index from theirs labels: A, B, C ...., Z, AA, AB, etc.

Callers 5

CoreFunction · 0.90
data.unit.tsFile · 0.90
helpers.types.tsFile · 0.90
createSpreadsheetDataFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…