public static function anyToRC($cell) { $cell = strtoupper($cell); preg_match('#^R(\\d+)C(\\d+)$#', $cell, $m); if (count($m) === 3) { return array('r' => intval($m['1']), 'c' => intval($m['2'])); } preg_match('#^([A-Z]+)(\\d+)$#', $cell, $m); if (count($m) === 3) { return array('r' => intval($m['2']), 'c' => CellConverter::toNumber($m['1'])); } throw new Exception("Wrong decomposition of cell literal '{$cell}'"); }
/** * @expectedException Exception * @expectedExceptionMessage ZZZA is out of range * @expectedExceptionCode null */ public function testToNumberException() { CellConverter::toNumber('ZZZA'); }