97                for (
$i = 0; 
$i <= 31; ++
$i) {
 
   98                        if (
$i != 9 && 
$i != 10 && 
$i != 13) {
 
   99                                $find = 
'_x' . 
sprintf(
'%04s' , strtoupper(dechex(
$i))) . 
'_';
 
  101                                self::$_controlCharacters[$find] = $replace;
 
  111                self::$_SYLKCharacters = array(
 
  144                        "\x1B'?"  => chr(127),
 
  278                if (isset(self::$_isMbstringEnabled)) {
 
  282                self::$_isMbstringEnabled = function_exists(
'mb_convert_encoding') ?
 
  295                if (isset(self::$_isIconvEnabled)) {
 
  300                if (!function_exists(
'iconv')) {
 
  301                        self::$_isIconvEnabled = 
false;
 
  306                if (!@iconv(
'UTF-8', 
'UTF-16LE', 
'x')) {
 
  307                        self::$_isIconvEnabled = 
false;
 
  313                if (!@iconv_substr(
'A', 0, 1, 
'UTF-8')) {
 
  314                        self::$_isIconvEnabled = 
false;
 
  319                if ( 
defined(
'PHP_OS') && @stristr(PHP_OS, 
'AIX')
 
  320                                && 
defined(
'ICONV_IMPL') && (@strcasecmp(ICONV_IMPL, 
'unknown') == 0)
 
  321                                && 
defined(
'ICONV_VERSION') && (@strcasecmp(ICONV_VERSION, 
'unknown') == 0) )
 
  323                        self::$_isIconvEnabled = 
false;
 
  328                self::$_isIconvEnabled = 
true;
 
  333                if(empty(self::$_controlCharacters)) {
 
  336                if(empty(self::$_SYLKCharacters)) {
 
  356                return str_replace( array_keys(self::$_controlCharacters), array_values(self::$_controlCharacters), $value );
 
  374                return str_replace( array_values(self::$_controlCharacters), array_keys(self::$_controlCharacters), $value );
 
  385                if (self::getIsIconvEnabled()) {
 
  386                        $value = @iconv(
'UTF-8', 
'UTF-8', $value);
 
  390                if (self::getIsMbstringEnabled()) {
 
  391                        $value = mb_convert_encoding($value, 
'UTF-8', 
'UTF-8');
 
  405        public static function IsUTF8($value = 
'') {
 
  406                return $value === 
'' || preg_match(
'/^./su', $value) === 1;
 
  417                if (is_float($value)) {
 
  418                        return str_replace(
',', 
'.', $value);
 
  420                return (
string) $value;
 
  439                if(empty($arrcRuns)){
 
  442                        $data = pack(
'CC', $ln, $opt);
 
  447                        $data = pack(
'vC', $ln, 0x09);
 
  448                        $data .= pack(
'v', count($arrcRuns));
 
  451                        foreach ($arrcRuns as $cRun){
 
  452                                $data .= pack(
'v', $cRun[
'strlen']);
 
  453                                $data .= pack(
'v', $cRun[
'fontidx']);
 
  481                $data = pack(
'vC', $ln, $opt) . $chars;
 
  495                if (self::getIsIconvEnabled()) {
 
  496                        return iconv(
$from, $to, $value);
 
  499                if (self::getIsMbstringEnabled()) {
 
  500                        return mb_convert_encoding($value, $to, 
$from);
 
  503                if(
$from == 
'UTF-16LE'){
 
  505                }
else if(
$from == 
'UTF-16BE'){
 
  528                if( strlen($str) < 2 ) 
return $str;
 
  531                if( $c0 == 0xfe && $c1 == 0xff ) { $str = substr($str,2); }
 
  532                elseif( $c0 == 0xff && $c1 == 0xfe ) { $str = substr($str,2); $bom_be = 
false; }
 
  536                        if( $bom_be ) { $val = ord($str{
$i})   << 4; $val += ord($str{
$i+1}); }
 
  537                        else {        $val = ord($str{
$i+1}) << 4; $val += ord($str{
$i}); }
 
  538                        $newstr .= ($val == 0x228) ? 
"\n" : chr($val);
 
  552                if (self::getIsMbstringEnabled()) {
 
  553                        return mb_strlen($value, $enc);
 
  556                if (self::getIsIconvEnabled()) {
 
  557                        return iconv_strlen($value, $enc);
 
  561                return strlen($value);
 
  572        public static function Substring($pValue = 
'', $pStart = 0, $pLength = 0)
 
  574                if (self::getIsMbstringEnabled()) {
 
  575                        return mb_substr($pValue, $pStart, $pLength, 
'UTF-8');
 
  578                if (self::getIsIconvEnabled()) {
 
  579                        return iconv_substr($pValue, $pStart, $pLength, 
'UTF-8');
 
  583                return substr($pValue, $pStart, $pLength);
 
  594                if (function_exists(
'mb_convert_case')) {
 
  595                        return mb_convert_case($pValue, MB_CASE_UPPER, 
"UTF-8");
 
  597                return strtoupper($pValue);
 
  608                if (function_exists(
'mb_convert_case')) {
 
  609                        return mb_convert_case($pValue, MB_CASE_LOWER, 
"UTF-8");
 
  611                return strtolower($pValue);
 
  623                if (function_exists(
'mb_convert_case')) {
 
  624                        return mb_convert_case($pValue, MB_CASE_TITLE, 
"UTF-8");
 
  626                return ucwords($pValue);
 
  631        return mb_strtolower($char, 
"UTF-8") != $char;
 
  636        # Split at all position not after the start: ^ 
  637        # and not before the end: $ 
  638        return preg_split(
'/(?<!^)(?!$)/u', $string );
 
  650        if (self::getIsMbstringEnabled()) {
 
  652            foreach($characters as &$character) {
 
  653                if(self::mb_is_upper($character)) {
 
  654                    $character = mb_strtolower($character, 
'UTF-8');
 
  656                    $character = mb_strtoupper($character, 
'UTF-8');
 
  659            return implode(
'', $characters);
 
  661                return strtolower($pValue) ^ strtoupper($pValue) ^ $pValue;
 
  672                if (preg_match(
'/^'.self::STRING_REGEXP_FRACTION.
'$/i', $operand, $match)) {
 
  673                        $sign = ($match[1] == 
'-') ? 
'-' : 
'+';
 
  674                        $fractionFormula = 
'='.$sign.$match[2].$sign.$match[3];
 
  689                if (!isset(self::$_decimalSeparator)) {
 
  690                        $localeconv = localeconv();
 
  691                        self::$_decimalSeparator = ($localeconv[
'decimal_point'] != 
'')
 
  692                                ? $localeconv[
'decimal_point'] : $localeconv[
'mon_decimal_point'];
 
  694                        if (self::$_decimalSeparator == 
'') {
 
  696                                self::$_decimalSeparator = 
'.';
 
  710                self::$_decimalSeparator = $pValue;
 
  721                if (!isset(self::$_thousandsSeparator)) {
 
  722                        $localeconv = localeconv();
 
  723                        self::$_thousandsSeparator = ($localeconv[
'thousands_sep'] != 
'')
 
  724                                ? $localeconv[
'thousands_sep'] : $localeconv[
'mon_thousands_sep'];
 
  726                        if (self::$_thousandsSeparator == 
'') {
 
  728                                self::$_thousandsSeparator = 
',';
 
  742                self::$_thousandsSeparator = $pValue;
 
  753                if (!isset(self::$_currencyCode)) {
 
  754                        $localeconv = localeconv();
 
  755                        self::$_currencyCode = ($localeconv[
'currency_symbol'] != 
'')
 
  756                                ? $localeconv[
'currency_symbol'] : $localeconv[
'int_curr_symbol'];
 
  758                        if (self::$_currencyCode == 
'') {
 
  760                                self::$_currencyCode = 
'$';
 
  774                self::$_currencyCode = $pValue;
 
  786                if (strpos($pValue, 
'␛') === 
false) {
 
  790                foreach (self::$_SYLKCharacters as $k => $v) {
 
  791                        $pValue = str_replace($k, $v, $pValue);
 
  806                if (is_numeric($value))
 
  808                $v = floatval($value);
 
  809                return (is_numeric(substr($value, 0, strlen($v)))) ? $v : $value;
 
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
static getInstance(PHPExcel $workbook=NULL)
Get an instance of this class.
static mb_is_upper($char)
static setDecimalSeparator($pValue='.')
Set the decimal separator.
static ConvertEncoding($value, $to, $from)
Convert string from one encoding to another.
static ControlCharacterOOXML2PHP($value='')
Convert from OpenXML escaped control character to PHP control character.
static setCurrencyCode($pValue='$')
Set the currency code.
static _buildSYLKCharacters()
Build SYLK characters array.
static utf16_decode($str, $bom_be=TRUE)
Decode UTF-16 encoded strings.
static convertToNumberIfFraction(&$operand)
Identify whether a string contains a fractional numeric value, and convert it to a numeric if it is.
static getDecimalSeparator()
Get the decimal separator.
static StrToUpper($pValue='')
Convert a UTF-8 encoded string to upper case.
static CountCharacters($value, $enc='UTF-8')
Get character count.
static StrToTitle($pValue='')
Convert a UTF-8 encoded string to title/proper case (uppercase every first character in each word,...
static SanitizeUTF8($value)
Try to sanitize UTF8, stripping invalid byte sequences.
static $_decimalSeparator
static mb_str_split($string)
static $_controlCharacters
static StrToLower($pValue='')
Convert a UTF-8 encoded string to lower case.
static StrCaseReverse($pValue='')
Reverse the case of a string, so that all uppercase characters become lowercase and all lowercase cha...
static UTF8toBIFF8UnicodeLong($value)
Converts a UTF-8 string into BIFF8 Unicode string data (16-bit string length) Writes the string using...
const STRING_REGEXP_FRACTION
Constants
static FormatNumber($value)
Formats a numeric value as a string for output in various output writers forcing point as decimal sep...
static Substring($pValue='', $pStart=0, $pLength=0)
Get a substring of a UTF-8 encoded string.
static _buildControlCharacters()
Build control characters array.
static ControlCharacterPHP2OOXML($value='')
Convert from PHP control character to OpenXML escaped control character.
static SYLKtoUTF8($pValue='')
Convert SYLK encoded string to UTF-8.
static $_SYLKCharacters
SYLK Characters array.
static getIsMbstringEnabled()
Get whether mbstring extension is available.
static getIsIconvEnabled()
Get whether iconv extension is available.
static getThousandsSeparator()
Get the thousands separator.
static $_isMbstringEnabled
static testStringAsNumeric($value)
Retrieve any leading numeric part of a string, or return the full string if no leading numeric (handl...
static UTF8toBIFF8UnicodeShort($value, $arrcRuns=array())
Converts a UTF-8 string into BIFF8 Unicode string data (8-bit string length) Writes the string using ...
static setThousandsSeparator($pValue=',')
Set the thousands separator.
static IsUTF8($value='')
Check if a string contains UTF8 data.
static buildCharacterSets()
static $_thousandsSeparator
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'