You are here

public static function PHPExcel_ReferenceHelper::cellSort in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/ReferenceHelper.php \PHPExcel_ReferenceHelper::cellSort()

* Compare two cell addresses * Intended for use as a Callback function for sorting cell addresses by column and row * *

Parameters

string $a First cell to test (e.g. 'AA1'): * @param string $b Second cell to test (e.g. 'Z1') * @return integer

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/ReferenceHelper.php, line 103

Class

PHPExcel_ReferenceHelper
PHPExcel_ReferenceHelper (Singleton)

Code

public static function cellSort($a, $b) {
  sscanf($a, '%[A-Z]%d', $ac, $ar);
  sscanf($b, '%[A-Z]%d', $bc, $br);
  if ($ar == $br) {
    return strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
  }
  return $ar < $br ? -1 : 1;
}