当前路径:Classes/PHPExcel/Calculation/TextData.php <?php /** PHPExcel root directory */ if (!defined('PHPEXCEL_ROOT')) { /** * @ignore */ define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); } /** * PHPExcel_Calculation_TextData * * Copyright (c) 2006 - 2015 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel * @package PHPExcel_Calculation * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ class PHPExcel_Calculation_TextData { private static $invalidChars; private static function unicodeToOrd($c) { if (ord($c{0}) >=0 && ord($c{0}) <= 127) { return ord($c{0}); } elseif (ord($c{0}) >= 192 && ord($c{0}) <= 223) { return (ord($c{0})-192)*64 + (ord($c{1})-128); } elseif (ord($c{0}) >= 224 && ord($c{0}) <= 239) { return (ord($c{0})-224)*4096 + (ord($c{1})-128)*64 + (ord($c{2})-128); } elseif (ord($c{0}) >= 240 && ord($c{0}) <= 247) { return (ord($c{0})-240)*262144 + (ord($c{1})-128)*4096 + (ord($c{2})-128)*64 + (ord($c{3})-128); } elseif (ord($c{0}) >= 248 && ord($c{0}) <= 251) { return (ord($c{0})-248)*16777216 + (ord($c{1})-128)*262144 + (ord($c{2})-128)*4096 + (ord($c{3})-128)*64 + (ord($c{4})-128); } elseif (ord($c{0}) >= 252 && ord($c{0}) <= 253) { return (ord($c{0})-252)*1073741824 + (ord($c{1})-128)*16777216 + (ord($c{2})-128)*262144 + (ord($c{3})-128)*4096 + (ord($c{4})-128)*64 + (ord($c{5})-128); } elseif (ord($c{0}) >= 254 && ord($c{0}) <= 255) { // error return PHPExcel_Calculation_Functions::VALUE(); } return 0; } /** * CHARACTER * * @param string $character Value * @return int */ public static function CHARACTER($character) { $character = PHPExcel_Calculation_Functions::flattenSingleValue($character); if ((!is_numeric($character)) || ($character < 0)) { return PHPExcel_Calculation_Functions::VALUE(); } if (function_exists('mb_convert_encoding')) { return mb_convert_encoding('&#'.intval($character).';', 'UTF-8', 'HTML-ENTITIES'); } else { return chr(intval($character)); } } /** * TRIMNONPRINTABLE * * @param mixed $stringValue Value to check * @return string */ public static function TRIMNONPRINTABLE($stringValue = '') { $stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue); if (is_bool($stringValue)) { return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); } if (self::$invalidChars == null) { self::$invalidChars = range(chr(0), chr(31)); } if (is_string($stringValue) || is_numeric($stringValue)) { return str_replace(self::$invalidChars, '', trim($stringValue, "\x00..\x1F")); } return null; } /** * TRIMSPACES * * @param mixed $stringValue Value to check * @return string */ public static function TRIMSPACES($stringValue = '') { $stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue); if (is_bool($stringValue)) { return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); } if (is_string($stringValue) || is_numeric($stringValue)) { return trim(preg_replace(...
完整源码文件,请先购买后再查看
相关源码
- 设备管理系统2023-12-07
- 企业办公OA系统2023-12-07
- 网吧管理系统2023-12-06
- 基于SPRINGBOOT质量管理系统2023-12-06
- 家电销售网站2023-12-06
- 基于SPRINGBOOT小学教学辅助平台2023-12-05
关于我们 | 顾问团队 | 发展历程 | 联系我们 | 源码上传
联系电话(Tel):4008-010-151(免长途)
地址:北京市海淀区大恒科技大厦五层 邮编:100080
Floor 5th,Daheng Building,Zhongguancun,Beijing,China,100080
51Aspx.com 版权所有 CopyRight © 2006-2023. 京ICP备09089570号 | 京公网安备11010702000869号
联系电话(Tel):4008-010-151(免长途)
地址:北京市海淀区大恒科技大厦五层 邮编:100080
Floor 5th,Daheng Building,Zhongguancun,Beijing,China,100080
51Aspx.com 版权所有 CopyRight © 2006-2023. 京ICP备09089570号 | 京公网安备11010702000869号