You are here

public static function PHPExcel_Calculation_TextData::ASCIICODE in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/TextData.php \PHPExcel_Calculation_TextData::ASCIICODE()

* ASCIICODE * *

Parameters

string $characters Value: * @return int

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/TextData.php, line 138

Class

PHPExcel_Calculation_TextData
PHPExcel_Calculation_TextData

Code

public static function ASCIICODE($characters) {
  if ($characters === NULL || $characters === '') {
    return PHPExcel_Calculation_Functions::VALUE();
  }
  $characters = PHPExcel_Calculation_Functions::flattenSingleValue($characters);
  if (is_bool($characters)) {
    if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
      $characters = (int) $characters;
    }
    else {
      $characters = $characters ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
    }
  }
  $character = $characters;
  if (function_exists('mb_strlen') && function_exists('mb_substr')) {
    if (mb_strlen($characters, 'UTF-8') > 1) {
      $character = mb_substr($characters, 0, 1, 'UTF-8');
    }
    return self::_uniord($character);
  }
  else {
    if (strlen($characters) > 0) {
      $character = substr($characters, 0, 1);
    }
    return ord($character);
  }
}