ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
PHPExcel_Shared_String Class Reference
+ Collaboration diagram for PHPExcel_Shared_String:

Static Public Member Functions

static getIsMbstringEnabled ()
 Get whether mbstring extension is available.
static getIsIconvEnabled ()
 Get whether iconv extension is available.
static buildCharacterSets ()
static ControlCharacterOOXML2PHP ($value= '')
 Convert from OpenXML escaped control character to PHP control character.
static ControlCharacterPHP2OOXML ($value= '')
 Convert from PHP control character to OpenXML escaped control character.
static SanitizeUTF8 ($value)
 Try to sanitize UTF8, stripping invalid byte sequences.
static IsUTF8 ($value= '')
 Check if a string contains UTF8 data.
static FormatNumber ($value)
 Formats a numeric value as a string for output in various output writers forcing point as decimal separator in case locale is other than English.
static UTF8toBIFF8UnicodeShort ($value)
 Converts a UTF-8 string into BIFF8 Unicode string data (8-bit string length) Writes the string using uncompressed notation, no rich text, no Asian phonetics If mbstring extension is not available, ASCII is assumed, and compressed notation is used although this will give wrong results for non-ASCII strings see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect.
static UTF8toBIFF8UnicodeLong ($value)
 Converts a UTF-8 string into BIFF8 Unicode string data (16-bit string length) Writes the string using uncompressed notation, no rich text, no Asian phonetics If mbstring extension is not available, ASCII is assumed, and compressed notation is used although this will give wrong results for non-ASCII strings see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect.
static ConvertEncoding ($value, $to, $from)
 Convert string from one encoding to another.
static utf16_decode ($str, $bom_be=true)
 Decode UTF-16 encoded strings.
static CountCharacters ($value, $enc= 'UTF-8')
 Get character count.
static Substring ($pValue= '', $pStart=0, $pLength=0)
 Get a substring of a UTF-8 encoded string.
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 setDecimalSeparator ($pValue= '.')
 Set the decimal separator.
static getThousandsSeparator ()
 Get the thousands separator.
static setThousandsSeparator ($pValue= ',')
 Set the thousands separator.
static getCurrencyCode ()
 Get the currency code.
static setCurrencyCode ($pValue= '$')
 Set the currency code.
static SYLKtoUTF8 ($pValue= '')
 Convert SYLK encoded string to UTF-8.

Data Fields

const STRING_REGEXP_FRACTION = '(-?)(\d+)\s+(\d+\/\d+)'
 Constants.

Static Private Member Functions

static _buildControlCharacters ()
 Build control characters array.
static _buildSYLKCharacters ()
 Build SYLK characters array.

Static Private Attributes

static $_controlCharacters = array()
static $_SYLKCharacters = array()
 SYLK Characters array.
static $_decimalSeparator
static $_thousandsSeparator
static $_currencyCode
static $_isMbstringEnabled
static $_isIconvEnabled

Detailed Description

Definition at line 36 of file String.php.

Member Function Documentation

static PHPExcel_Shared_String::_buildControlCharacters ( )
staticprivate

Build control characters array.

Definition at line 96 of file String.php.

Referenced by buildCharacterSets().

{
for ($i = 0; $i <= 31; ++$i) {
if ($i != 9 && $i != 10 && $i != 13) {
$find = '_x' . sprintf('%04s' , strtoupper(dechex($i))) . '_';
$replace = chr($i);
self::$_controlCharacters[$find] = $replace;
}
}
}

+ Here is the caller graph for this function:

static PHPExcel_Shared_String::_buildSYLKCharacters ( )
staticprivate

Build SYLK characters array.

Definition at line 109 of file String.php.

Referenced by buildCharacterSets().

{
self::$_SYLKCharacters = array(
"\x1B 0" => chr(0),
"\x1B 1" => chr(1),
"\x1B 2" => chr(2),
"\x1B 3" => chr(3),
"\x1B 4" => chr(4),
"\x1B 5" => chr(5),
"\x1B 6" => chr(6),
"\x1B 7" => chr(7),
"\x1B 8" => chr(8),
"\x1B 9" => chr(9),
"\x1B :" => chr(10),
"\x1B ;" => chr(11),
"\x1B <" => chr(12),
"\x1B :" => chr(13),
"\x1B >" => chr(14),
"\x1B ?" => chr(15),
"\x1B!0" => chr(16),
"\x1B!1" => chr(17),
"\x1B!2" => chr(18),
"\x1B!3" => chr(19),
"\x1B!4" => chr(20),
"\x1B!5" => chr(21),
"\x1B!6" => chr(22),
"\x1B!7" => chr(23),
"\x1B!8" => chr(24),
"\x1B!9" => chr(25),
"\x1B!:" => chr(26),
"\x1B!;" => chr(27),
"\x1B!<" => chr(28),
"\x1B!=" => chr(29),
"\x1B!>" => chr(30),
"\x1B!?" => chr(31),
"\x1B'?" => chr(127),
"\x1B(0" => '€', // 128 in CP1252
"\x1B(2" => '‚', // 130 in CP1252
"\x1B(3" => 'ƒ', // 131 in CP1252
"\x1B(4" => '„', // 132 in CP1252
"\x1B(5" => '…', // 133 in CP1252
"\x1B(6" => '†', // 134 in CP1252
"\x1B(7" => '‡', // 135 in CP1252
"\x1B(8" => 'ˆ', // 136 in CP1252
"\x1B(9" => '‰', // 137 in CP1252
"\x1B(:" => 'Š', // 138 in CP1252
"\x1B(;" => '‹', // 139 in CP1252
"\x1BNj" => 'Œ', // 140 in CP1252
"\x1B(>" => 'Ž', // 142 in CP1252
"\x1B)1" => '‘', // 145 in CP1252
"\x1B)2" => '’', // 146 in CP1252
"\x1B)3" => '“', // 147 in CP1252
"\x1B)4" => '”', // 148 in CP1252
"\x1B)5" => '•', // 149 in CP1252
"\x1B)6" => '–', // 150 in CP1252
"\x1B)7" => '—', // 151 in CP1252
"\x1B)8" => '˜', // 152 in CP1252
"\x1B)9" => '™', // 153 in CP1252
"\x1B):" => 'š', // 154 in CP1252
"\x1B);" => '›', // 155 in CP1252
"\x1BNz" => 'œ', // 156 in CP1252
"\x1B)>" => 'ž', // 158 in CP1252
"\x1B)?" => 'Ÿ', // 159 in CP1252
"\x1B*0" => ' ', // 160 in CP1252
"\x1BN!" => '¡', // 161 in CP1252
"\x1BN\"" => '¢', // 162 in CP1252
"\x1BN#" => '£', // 163 in CP1252
"\x1BN(" => '¤', // 164 in CP1252
"\x1BN%" => '¥', // 165 in CP1252
"\x1B*6" => '¦', // 166 in CP1252
"\x1BN'" => '§', // 167 in CP1252
"\x1BNH " => '¨', // 168 in CP1252
"\x1BNS" => '©', // 169 in CP1252
"\x1BNc" => 'ª', // 170 in CP1252
"\x1BN+" => '«', // 171 in CP1252
"\x1B*<" => '¬', // 172 in CP1252
"\x1B*=" => '­', // 173 in CP1252
"\x1BNR" => '®', // 174 in CP1252
"\x1B*?" => '¯', // 175 in CP1252
"\x1BN0" => '°', // 176 in CP1252
"\x1BN1" => '±', // 177 in CP1252
"\x1BN2" => '²', // 178 in CP1252
"\x1BN3" => '³', // 179 in CP1252
"\x1BNB " => '´', // 180 in CP1252
"\x1BN5" => 'µ', // 181 in CP1252
"\x1BN6" => '¶', // 182 in CP1252
"\x1BN7" => '·', // 183 in CP1252
"\x1B+8" => '¸', // 184 in CP1252
"\x1BNQ" => '¹', // 185 in CP1252
"\x1BNk" => 'º', // 186 in CP1252
"\x1BN;" => '»', // 187 in CP1252
"\x1BN<" => '¼', // 188 in CP1252
"\x1BN=" => '½', // 189 in CP1252
"\x1BN>" => '¾', // 190 in CP1252
"\x1BN?" => '¿', // 191 in CP1252
"\x1BNAA" => 'À', // 192 in CP1252
"\x1BNBA" => 'Á', // 193 in CP1252
"\x1BNCA" => 'Â', // 194 in CP1252
"\x1BNDA" => 'Ã', // 195 in CP1252
"\x1BNHA" => 'Ä', // 196 in CP1252
"\x1BNJA" => 'Å', // 197 in CP1252
"\x1BNa" => 'Æ', // 198 in CP1252
"\x1BNKC" => 'Ç', // 199 in CP1252
"\x1BNAE" => 'È', // 200 in CP1252
"\x1BNBE" => 'É', // 201 in CP1252
"\x1BNCE" => 'Ê', // 202 in CP1252
"\x1BNHE" => 'Ë', // 203 in CP1252
"\x1BNAI" => 'Ì', // 204 in CP1252
"\x1BNBI" => 'Í', // 205 in CP1252
"\x1BNCI" => 'Î', // 206 in CP1252
"\x1BNHI" => 'Ï', // 207 in CP1252
"\x1BNb" => 'Ð', // 208 in CP1252
"\x1BNDN" => 'Ñ', // 209 in CP1252
"\x1BNAO" => 'Ò', // 210 in CP1252
"\x1BNBO" => 'Ó', // 211 in CP1252
"\x1BNCO" => 'Ô', // 212 in CP1252
"\x1BNDO" => 'Õ', // 213 in CP1252
"\x1BNHO" => 'Ö', // 214 in CP1252
"\x1B-7" => '×', // 215 in CP1252
"\x1BNi" => 'Ø', // 216 in CP1252
"\x1BNAU" => 'Ù', // 217 in CP1252
"\x1BNBU" => 'Ú', // 218 in CP1252
"\x1BNCU" => 'Û', // 219 in CP1252
"\x1BNHU" => 'Ü', // 220 in CP1252
"\x1B-=" => 'Ý', // 221 in CP1252
"\x1BNl" => 'Þ', // 222 in CP1252
"\x1BN{" => 'ß', // 223 in CP1252
"\x1BNAa" => 'à', // 224 in CP1252
"\x1BNBa" => 'á', // 225 in CP1252
"\x1BNCa" => 'â', // 226 in CP1252
"\x1BNDa" => 'ã', // 227 in CP1252
"\x1BNHa" => 'ä', // 228 in CP1252
"\x1BNJa" => 'å', // 229 in CP1252
"\x1BNq" => 'æ', // 230 in CP1252
"\x1BNKc" => 'ç', // 231 in CP1252
"\x1BNAe" => 'è', // 232 in CP1252
"\x1BNBe" => 'é', // 233 in CP1252
"\x1BNCe" => 'ê', // 234 in CP1252
"\x1BNHe" => 'ë', // 235 in CP1252
"\x1BNAi" => 'ì', // 236 in CP1252
"\x1BNBi" => 'í', // 237 in CP1252
"\x1BNCi" => 'î', // 238 in CP1252
"\x1BNHi" => 'ï', // 239 in CP1252
"\x1BNs" => 'ð', // 240 in CP1252
"\x1BNDn" => 'ñ', // 241 in CP1252
"\x1BNAo" => 'ò', // 242 in CP1252
"\x1BNBo" => 'ó', // 243 in CP1252
"\x1BNCo" => 'ô', // 244 in CP1252
"\x1BNDo" => 'õ', // 245 in CP1252
"\x1BNHo" => 'ö', // 246 in CP1252
"\x1B/7" => '÷', // 247 in CP1252
"\x1BNy" => 'ø', // 248 in CP1252
"\x1BNAu" => 'ù', // 249 in CP1252
"\x1BNBu" => 'ú', // 250 in CP1252
"\x1BNCu" => 'û', // 251 in CP1252
"\x1BNHu" => 'ü', // 252 in CP1252
"\x1B/=" => 'ý', // 253 in CP1252
"\x1BN|" => 'þ', // 254 in CP1252
"\x1BNHy" => 'ÿ', // 255 in CP1252
);
}

+ Here is the caller graph for this function:

static PHPExcel_Shared_String::buildCharacterSets ( )
static

Definition at line 332 of file String.php.

References _buildControlCharacters(), and _buildSYLKCharacters().

{
if(empty(self::$_controlCharacters)) {
}
if(empty(self::$_SYLKCharacters)) {
}
}

+ Here is the call graph for this function:

static PHPExcel_Shared_String::ControlCharacterOOXML2PHP (   $value = '')
static

Convert from OpenXML escaped control character to PHP control character.

Excel 2007 team:

That's correct, control characters are stored directly in the shared-strings table. We do encode characters that cannot be represented in XML using the following escape sequence: xHHHH where H represents a hexadecimal character in the character's value... So you could end up with something like x0008 in a string (either in a cell value (<v>) element or in the shared string <t> element.

Parameters
string$valueValue to unescape
Returns
string

Definition at line 355 of file String.php.

Referenced by PHPExcel_Reader_Excel2007\_parseRichText(), and PHPExcel_Reader_Excel2007\load().

{
return str_replace( array_keys(self::$_controlCharacters), array_values(self::$_controlCharacters), $value );
}

+ Here is the caller graph for this function:

static PHPExcel_Shared_String::ControlCharacterPHP2OOXML (   $value = '')
static

Convert from PHP control character to OpenXML escaped control character.

Excel 2007 team:

That's correct, control characters are stored directly in the shared-strings table. We do encode characters that cannot be represented in XML using the following escape sequence: xHHHH where H represents a hexadecimal character in the character's value... So you could end up with something like x0008 in a string (either in a cell value (<v>) element or in the shared string <t> element.

Parameters
string$valueValue to escape
Returns
string

Definition at line 373 of file String.php.

Referenced by PHPExcel_Writer_Excel2007_Worksheet\_writeCell(), PHPExcel_Writer_Excel2007_StringTable\writeRichText(), and PHPExcel_Writer_Excel2007_StringTable\writeStringTable().

{
return str_replace( array_values(self::$_controlCharacters), array_keys(self::$_controlCharacters), $value );
}

+ Here is the caller graph for this function:

static PHPExcel_Shared_String::ConvertEncoding (   $value,
  $to,
  $from 
)
static

Convert string from one encoding to another.

First try iconv, then mbstring, or no convertion

Parameters
string$value
string$toEncoding to convert to, e.g. 'UTF-8'
string$fromEncoding to convert from, e.g. 'UTF-16LE'
Returns
string

Definition at line 483 of file String.php.

References utf16_decode().

Referenced by PHPExcel_Reader_Excel5\_decodeCodepage(), PHPExcel_Reader_Excel5\_encodeUTF16(), PHPExcel_Reader_Excel5\_readDocumentSummaryInformation(), PHPExcel_Reader_Excel5\_readSummaryInformation(), PHPExcel_Writer_Excel5_Worksheet\_writeUrlInternal(), PHPExcel_Reader_CSV\loadIntoExisting(), UTF8toBIFF8UnicodeLong(), and UTF8toBIFF8UnicodeShort().

{
if (self::getIsIconvEnabled()) {
$value = iconv($from, $to, $value);
return $value;
}
if (self::getIsMbstringEnabled()) {
$value = mb_convert_encoding($value, $to, $from);
return $value;
}
if($from == 'UTF-16LE'){
return self::utf16_decode($value, false);
}else if($from == 'UTF-16BE'){
return self::utf16_decode($value);
}
// else, no conversion
return $value;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Shared_String::convertToNumberIfFraction ( $operand)
static

Identify whether a string contains a fractional numeric value, and convert it to a numeric if it is.

Parameters
string&$operandstring value to test
Returns
boolean

Definition at line 585 of file String.php.

References PHPExcel_Calculation\getInstance().

Referenced by PHPExcel_Calculation\_validateBinaryOperand(), PHPExcel_Shared_JAMA_Matrix\arrayRightDivide(), PHPExcel_Shared_JAMA_Matrix\arrayTimesEquals(), PHPExcel_Shared_JAMA_Matrix\minusEquals(), PHPExcel_Shared_JAMA_Matrix\plusEquals(), and PHPExcel_Shared_JAMA_Matrix\power().

{
if (preg_match('/^'.self::STRING_REGEXP_FRACTION.'$/i', $operand, $match)) {
$sign = ($match[1] == '-') ? '-' : '+';
$fractionFormula = '='.$sign.$match[2].$sign.$match[3];
$operand = PHPExcel_Calculation::getInstance()->_calculateFormulaValue($fractionFormula);
return true;
}
return false;
} // function convertToNumberIfFraction()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Shared_String::CountCharacters (   $value,
  $enc = 'UTF-8' 
)
static

Get character count.

First try mbstring, then iconv, finally strlen

Parameters
string$value
string$encEncoding
Returns
int Character count

Definition at line 541 of file String.php.

References $enc.

Referenced by PHPExcel_Worksheet\_checkSheetTitle(), PHPExcel_Reader_Excel5\_readLabelSst(), PHPExcel_Writer_Excel5_Worksheet\_writeUrlInternal(), PHPExcel_Shared_Font\getTextWidthPixelsApprox(), PHPExcel_Worksheet\setTitle(), UTF8toBIFF8UnicodeLong(), and UTF8toBIFF8UnicodeShort().

{
if (self::getIsIconvEnabled()) {
return iconv_strlen($value, $enc);
}
if (self::getIsMbstringEnabled()) {
return mb_strlen($value, $enc);
}
// else strlen
return strlen($value);
}

+ Here is the caller graph for this function:

static PHPExcel_Shared_String::FormatNumber (   $value)
static

Formats a numeric value as a string for output in various output writers forcing point as decimal separator in case locale is other than English.

Parameters
mixed$value
Returns
string

Definition at line 416 of file String.php.

Referenced by PHPExcel_Writer_Excel2007_Worksheet\_writeCell(), PHPExcel_Writer_Excel2007_Worksheet\_writeCols(), PHPExcel_Writer_Excel2007_Worksheet\_writePageMargins(), PHPExcel_Writer_Excel2007_Worksheet\_writeSheetData(), and PHPExcel_Writer_Excel2007_Worksheet\_writeSheetFormatPr().

{
if (is_float($value)) {
return str_replace(',', '.', $value);
}
return (string) $value;
}

+ Here is the caller graph for this function:

static PHPExcel_Shared_String::getCurrencyCode ( )
static

Get the currency code.

If it has not yet been set explicitly, try to obtain the symbol information from locale.

Returns
string

Definition at line 660 of file String.php.

References $_currencyCode.

Referenced by PHPExcel_Style_NumberFormat\toFormattedString().

{
if (!isset(self::$_currencyCode)) {
$localeconv = localeconv();
self::$_currencyCode = $localeconv['currency_symbol'] != ''
? $localeconv['currency_symbol'] : $localeconv['int_curr_symbol'];
if (self::$_currencyCode == '') {
// Default to $
self::$_currencyCode = '$';
}
}
}

+ Here is the caller graph for this function:

static PHPExcel_Shared_String::getDecimalSeparator ( )
static

Get the decimal separator.

If it has not yet been set explicitly, try to obtain number formatting information from locale.

Returns
string

Definition at line 601 of file String.php.

References $_decimalSeparator.

Referenced by PHPExcel_Style_NumberFormat\toFormattedString().

{
if (!isset(self::$_decimalSeparator)) {
$localeconv = localeconv();
self::$_decimalSeparator = $localeconv['decimal_point'] != ''
? $localeconv['decimal_point'] : $localeconv['mon_decimal_point'];
if (self::$_decimalSeparator == '') {
// Default to .
self::$_decimalSeparator = '.';
}
}
}

+ Here is the caller graph for this function:

static PHPExcel_Shared_String::getIsIconvEnabled ( )
static

Get whether iconv extension is available.

Returns
boolean

Definition at line 293 of file String.php.

References $_isIconvEnabled.

Referenced by UTF8toBIFF8UnicodeLong(), and UTF8toBIFF8UnicodeShort().

{
if (isset(self::$_isIconvEnabled)) {
}
// Fail if iconv doesn't exist
if (!function_exists('iconv')) {
self::$_isIconvEnabled = false;
return false;
}
// Sometimes iconv is not working, and e.g. iconv('UTF-8', 'UTF-16LE', 'x') just returns false,
if (!@iconv('UTF-8', 'UTF-16LE', 'x')) {
self::$_isIconvEnabled = false;
return false;
}
// Sometimes iconv_substr('A', 0, 1, 'UTF-8') just returns false in PHP 5.2.0
// we cannot use iconv in that case either (http://bugs.php.net/bug.php?id=37773)
if (!@iconv_substr('A', 0, 1, 'UTF-8')) {
self::$_isIconvEnabled = false;
return false;
}
// CUSTOM: IBM AIX iconv() does not work
if ( defined('PHP_OS') && @stristr(PHP_OS, 'AIX')
&& defined('ICONV_IMPL') && (@strcasecmp(ICONV_IMPL, 'unknown') == 0)
&& defined('ICONV_VERSION') && (@strcasecmp(ICONV_VERSION, 'unknown') == 0) )
{
self::$_isIconvEnabled = false;
return false;
}
// If we reach here no problems were detected with iconv
self::$_isIconvEnabled = true;
return true;
}

+ Here is the caller graph for this function:

static PHPExcel_Shared_String::getIsMbstringEnabled ( )
static

Get whether mbstring extension is available.

Returns
boolean

Definition at line 276 of file String.php.

References $_isMbstringEnabled.

Referenced by UTF8toBIFF8UnicodeLong(), and UTF8toBIFF8UnicodeShort().

{
if (isset(self::$_isMbstringEnabled)) {
}
self::$_isMbstringEnabled = function_exists('mb_convert_encoding') ?
true : false;
}

+ Here is the caller graph for this function:

static PHPExcel_Shared_String::getThousandsSeparator ( )
static

Get the thousands separator.

If it has not yet been set explicitly, try to obtain number formatting information from locale.

Returns
string

Definition at line 633 of file String.php.

References $_thousandsSeparator.

Referenced by PHPExcel_Style_NumberFormat\toFormattedString().

{
if (!isset(self::$_thousandsSeparator)) {
$localeconv = localeconv();
self::$_thousandsSeparator = $localeconv['thousands_sep'] != ''
? $localeconv['thousands_sep'] : $localeconv['mon_thousands_sep'];
}
}

+ Here is the caller graph for this function:

static PHPExcel_Shared_String::IsUTF8 (   $value = '')
static

Check if a string contains UTF8 data.

Parameters
string$value
Returns
boolean

Definition at line 405 of file String.php.

{
return utf8_encode(utf8_decode($value)) === $value;
}
static PHPExcel_Shared_String::SanitizeUTF8 (   $value)
static

Try to sanitize UTF8, stripping invalid byte sequences.

Not perfect. Does not surrogate characters.

Parameters
string$value
Returns
string

Definition at line 383 of file String.php.

Referenced by PHPExcel_Cell_AdvancedValueBinder\bindValue(), and PHPExcel_Cell_DefaultValueBinder\bindValue().

{
if (self::getIsIconvEnabled()) {
$value = @iconv('UTF-8', 'UTF-8', $value);
return $value;
}
if (self::getIsMbstringEnabled()) {
$value = mb_convert_encoding($value, 'UTF-8', 'UTF-8');
return $value;
}
// else, no conversion
return $value;
}

+ Here is the caller graph for this function:

static PHPExcel_Shared_String::setCurrencyCode (   $pValue = '$')
static

Set the currency code.

Only used by PHPExcel_Style_NumberFormat::toFormattedString() to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF

Parameters
string$pValueCharacter for currency code

Definition at line 681 of file String.php.

{
self::$_currencyCode = $pValue;
}
static PHPExcel_Shared_String::setDecimalSeparator (   $pValue = '.')
static

Set the decimal separator.

Only used by PHPExcel_Style_NumberFormat::toFormattedString() to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF

Parameters
string$pValueCharacter for decimal separator

Definition at line 622 of file String.php.

{
self::$_decimalSeparator = $pValue;
}
static PHPExcel_Shared_String::setThousandsSeparator (   $pValue = ',')
static

Set the thousands separator.

Only used by PHPExcel_Style_NumberFormat::toFormattedString() to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF

Parameters
string$pValueCharacter for thousands separator

Definition at line 649 of file String.php.

{
self::$_thousandsSeparator = $pValue;
}
static PHPExcel_Shared_String::Substring (   $pValue = '',
  $pStart = 0,
  $pLength = 0 
)
static

Get a substring of a UTF-8 encoded string.

Parameters
string$pValueUTF-8 encoded string
int$startStart offset
int$lengthMaximum number of characters in substring
Returns
string

Definition at line 563 of file String.php.

Referenced by PHPExcel_Reader_Excel5\_readLabelSst(), PHPExcel_Cell_DataType\checkString(), and PHPExcel_Worksheet\setTitle().

{
if (self::getIsIconvEnabled()) {
return iconv_substr($pValue, $pStart, $pLength, 'UTF-8');
}
if (self::getIsMbstringEnabled()) {
return mb_substr($pValue, $pStart, $pLength, 'UTF-8');
}
// else substr
return substr($pValue, $pStart, $pLength);
}

+ Here is the caller graph for this function:

static PHPExcel_Shared_String::SYLKtoUTF8 (   $pValue = '')
static

Convert SYLK encoded string to UTF-8.

Parameters
string$pValue
Returns
string UTF-8 encoded string

Definition at line 692 of file String.php.

Referenced by PHPExcel_Reader_SYLK\loadIntoExisting().

{
// If there is no escape character in the string there is nothing to do
if (strpos($pValue, '') === false) {
return $pValue;
}
foreach (self::$_SYLKCharacters as $k => $v) {
$pValue = str_replace($k, $v, $pValue);
}
return $pValue;
}

+ Here is the caller graph for this function:

static PHPExcel_Shared_String::utf16_decode (   $str,
  $bom_be = true 
)
static

Decode UTF-16 encoded strings.

Can handle both BOM'ed data and un-BOM'ed data. Assumes Big-Endian byte order if no BOM is available. This function was taken from http://php.net/manual/en/function.utf8-decode.php and $bom_be parameter added.

Parameters
string$strUTF-16 encoded data to decode.
Returns
string UTF-8 / ISO encoded data. public
Version
0.2 / 2010-05-13
Author
Rasmus Andersson http://rasmusandersson.se/
vadik56

Definition at line 518 of file String.php.

Referenced by ConvertEncoding().

{
if( strlen($str) < 2 ) return $str;
$c0 = ord($str{0});
$c1 = ord($str{1});
if( $c0 == 0xfe && $c1 == 0xff ) { $str = substr($str,2); }
elseif( $c0 == 0xff && $c1 == 0xfe ) { $str = substr($str,2); $bom_be = false; }
$len = strlen($str);
$newstr = '';
for($i=0;$i<$len;$i+=2) {
if( $bom_be ) { $val = ord($str{$i}) << 4; $val += ord($str{$i+1}); }
else { $val = ord($str{$i+1}) << 4; $val += ord($str{$i}); }
$newstr .= ($val == 0x228) ? "\n" : chr($val);
}
return $newstr;
}

+ Here is the caller graph for this function:

static PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong (   $value)
static

Converts a UTF-8 string into BIFF8 Unicode string data (16-bit string length) Writes the string using uncompressed notation, no rich text, no Asian phonetics If mbstring extension is not available, ASCII is assumed, and compressed notation is used although this will give wrong results for non-ASCII strings see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect.

2.5.3

Parameters
string$valueUTF-8 encoded string
Returns
string

Definition at line 459 of file String.php.

References $data, ConvertEncoding(), CountCharacters(), getIsIconvEnabled(), and getIsMbstringEnabled().

Referenced by PHPExcel_Writer_Excel5_Worksheet\_writeDataValidity(), PHPExcel_Writer_Excel5_Worksheet\_writeFooter(), PHPExcel_Writer_Excel5_Worksheet\_writeHeader(), PHPExcel_Writer_Excel5_Worksheet\_writeLabelSst(), PHPExcel_Writer_Excel5_Worksheet\_writeRangeProtection(), and PHPExcel_Writer_Excel5_Worksheet\_writeStringRecord().

{
// character count
$ln = self::CountCharacters($value, 'UTF-8');
// option flags
0x0001 : 0x0000;
// characters
$chars = self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
$data = pack('vC', $ln, $opt) . $chars;
return $data;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort (   $value)
static

Converts a UTF-8 string into BIFF8 Unicode string data (8-bit string length) Writes the string using uncompressed notation, no rich text, no Asian phonetics If mbstring extension is not available, ASCII is assumed, and compressed notation is used although this will give wrong results for non-ASCII strings see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect.

2.5.3

Parameters
string$valueUTF-8 encoded string
Returns
string

Definition at line 433 of file String.php.

References $data, ConvertEncoding(), CountCharacters(), getIsIconvEnabled(), and getIsMbstringEnabled().

Referenced by PHPExcel_Writer_Excel5_Workbook\_calcSheetOffsets(), PHPExcel_Writer_Excel5_Parser\_convertString(), and PHPExcel_Writer_Excel5_Font\writeFont().

{
// character count
$ln = self::CountCharacters($value, 'UTF-8');
// option flags
0x0001 : 0x0000;
// characters
$chars = self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
$data = pack('CC', $ln, $opt) . $chars;
return $data;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

PHPExcel_Shared_String::$_controlCharacters = array()
staticprivate

Definition at line 49 of file String.php.

PHPExcel_Shared_String::$_currencyCode
staticprivate

Definition at line 77 of file String.php.

Referenced by getCurrencyCode().

PHPExcel_Shared_String::$_decimalSeparator
staticprivate

Definition at line 63 of file String.php.

Referenced by getDecimalSeparator().

PHPExcel_Shared_String::$_isIconvEnabled
staticprivate

Definition at line 91 of file String.php.

Referenced by getIsIconvEnabled().

PHPExcel_Shared_String::$_isMbstringEnabled
staticprivate

Definition at line 84 of file String.php.

Referenced by getIsMbstringEnabled().

PHPExcel_Shared_String::$_SYLKCharacters = array()
staticprivate

SYLK Characters array.

$var array

Definition at line 56 of file String.php.

PHPExcel_Shared_String::$_thousandsSeparator
staticprivate

Definition at line 70 of file String.php.

Referenced by getThousandsSeparator().

const PHPExcel_Shared_String::STRING_REGEXP_FRACTION = '(-?)(\d+)\s+(\d+\/\d+)'

Constants.

Regular Expressions

Definition at line 41 of file String.php.


The documentation for this class was generated from the following file: