You are here

function ExcelRange::num2alpha in Feeds Excel 6

Same name and namespace in other branches
  1. 7 includes/ExcelRange.inc \ExcelRange::num2alpha()

Converts an integer into the alphabet base (A-Z).

@author Theriault

Theriault counts from 0 to x, phpExcelReader does from 1 to x.

Parameters

int $n This is the number to convert.:

Return value

string The converted number.

See also

http://www.php.net/manual/de/function.base-convert.php#94874

1 call to ExcelRange::num2alpha()
feeds_excel_token_values in ./feeds_excel.module
Implementation of hook_token_values().

File

includes/ExcelRange.inc, line 352

Class

ExcelRange

Code

function num2alpha($n) {
  $r = '';
  $n--;
  for ($i = 1; $n >= 0 && $i < 10; $i++) {
    $r = chr(0x41 + $n % pow(26, $i) / pow(26, $i - 1)) . $r;
    $n -= pow(26, $i);
  }
  return $r;
}