You are here

function ExcelRange::num2alpha in Feeds Excel 7

Same name and namespace in other branches
  1. 6 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__excel_column in ./feeds_excel.module
Helper function for rendering token values for excel column tokens.

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;
}