You are here

function ExcelRange::alpha2num in Feeds Excel 7

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

Converts an alphabetic string into an integer.

@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::alpha2num()
ExcelRange::range_expression_to_range_array in includes/ExcelRange.inc
Convert a single range expression to a range array

File

includes/ExcelRange.inc, line 372

Class

ExcelRange

Code

function alpha2num($alpha) {
  $a = str_split(strtoupper($alpha), 1);
  $r = 0;
  $l = count($a);
  for ($i = 0; $i < $l; $i++) {
    $r += pow(26, $i) * (ord($a[$l - $i - 1]) - 0x40);
  }
  return $r;
}