You are here

public static function PHPExcel_Calculation_TextData::SEARCHSENSITIVE 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::SEARCHSENSITIVE()

* SEARCHSENSITIVE * *

Parameters

string $needle The string to look for: * @param string $haystack The string in which to look * @param int $offset Offset within $haystack * @return string

File

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

Class

PHPExcel_Calculation_TextData
PHPExcel_Calculation_TextData

Code

public static function SEARCHSENSITIVE($needle, $haystack, $offset = 1) {
  $needle = PHPExcel_Calculation_Functions::flattenSingleValue($needle);
  $haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack);
  $offset = PHPExcel_Calculation_Functions::flattenSingleValue($offset);
  if (!is_bool($needle)) {
    if (is_bool($haystack)) {
      $haystack = $haystack ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
    }
    if ($offset > 0 && PHPExcel_Shared_String::CountCharacters($haystack) > $offset) {
      if (PHPExcel_Shared_String::CountCharacters($needle) == 0) {
        return $offset;
      }
      if (function_exists('mb_strpos')) {
        $pos = mb_strpos($haystack, $needle, --$offset, 'UTF-8');
      }
      else {
        $pos = strpos($haystack, $needle, --$offset);
      }
      if ($pos !== false) {
        return ++$pos;
      }
    }
  }
  return PHPExcel_Calculation_Functions::VALUE();
}