PHPExcel_Shared

# Class: PHPExcel_Shared_String Source Location: /PHPExcel/Shared/String.php
### Class Overview
PHPExcel_Shared_String #### Author(s): #### Copyright: Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel) | ### Constants STRING_REGEXP_FRACTION | ### Methods buildCharacterSets ControlCharacterOOXML2PHP ControlCharacterPHP2OOXML ConvertEncoding convertToNumberIfFraction CountCharacters FormatNumber getCurrencyCode getDecimalSeparator getIsIconvEnabled getIsMbstringEnabled getThousandsSeparator IsUTF8 SanitizeUTF8 setCurrencyCode setDecimalSeparator setThousandsSeparator Substring SYLKtoUTF8 testStringAsNumeric UTF8toBIFF8UnicodeLong UTF8toBIFF8UnicodeShort utf16_decode
### Class Details [line 36] PHPExcel_Shared_String #### Tags:
copyright: | Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
[ Top ] ### Class Methods ### static method buildCharacterSets [line 332]
`static void buildCharacterSets( )`
#### Tags:
access: | public
[ Top ] ### static method ControlCharacterOOXML2PHP [line 355]
`static string ControlCharacterOOXML2PHP( [string $value = ''])`
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. #### Tags:
access: | public
#### Parameters:
string | $value | Value to unescape
[ Top ] ### static method ControlCharacterPHP2OOXML [line 373]
`static string ControlCharacterPHP2OOXML( [string $value = ''])`
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. #### Tags:
access: | public
#### Parameters:
string | $value | Value to escape
[ Top ] ### static method ConvertEncoding [line 493]
`static string ConvertEncoding( string $value, string $to, string $from)`
Convert string from one encoding to another. First try iconv, then mbstring, or no convertion #### Tags:
access: | public
#### Parameters:
string | $value |
string | $to | Encoding to convert to, e.g. 'UTF-8'
string | $from | Encoding to convert from, e.g. 'UTF-16LE'
[ Top ] ### static method convertToNumberIfFraction [line 595]
`static boolean convertToNumberIfFraction( string &$operand)`
Identify whether a string contains a fractional numeric value, and convert it to a numeric if it is #### Tags:
access: | public
#### Parameters:
string | &$operand | string value to test
[ Top ] ### static method CountCharacters [line 551]
`static int CountCharacters( string $value, [string $enc = 'UTF-8'])`
Get character count. First try mbstring, then iconv, finally strlen #### Tags:
return: | Character count
access: | public
#### Parameters:
string | $value |
string | $enc | Encoding
[ Top ] ### static method FormatNumber [line 416]
`static string FormatNumber( mixed $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. #### Tags:
access: | public
#### Parameters:
mixed | $value |
[ Top ] ### static method getCurrencyCode [line 670]
`static string getCurrencyCode( )`
Get the currency code. If it has not yet been set explicitly, try to obtain the symbol information from locale. #### Tags:
access: | public
[ Top ] ### static method getDecimalSeparator [line 611]
`static string getDecimalSeparator( )`
Get the decimal separator. If it has not yet been set explicitly, try to obtain number formatting information from locale. #### Tags:
access: | public
[ Top ] ### static method getIsIconvEnabled [line 293]
`static boolean getIsIconvEnabled( )`
Get whether iconv extension is available #### Tags:
access: | public
[ Top ] ### static method getIsMbstringEnabled [line 276]
`static boolean getIsMbstringEnabled( )`
Get whether mbstring extension is available #### Tags:
access: | public
[ Top ] ### static method getThousandsSeparator [line 643]
`static string getThousandsSeparator( )`
Get the thousands separator. If it has not yet been set explicitly, try to obtain number formatting information from locale. #### Tags:
access: | public
[ Top ] ### static method IsUTF8 [line 405]
`static boolean IsUTF8( [string $value = ''])`
Check if a string contains UTF8 data #### Tags:
access: | public
#### Parameters:
string | $value |
[ Top ] ### static method SanitizeUTF8 [line 383]
`static string SanitizeUTF8( string $value)`
Try to sanitize UTF8, stripping invalid byte sequences. Not perfect. Does not surrogate characters. #### Tags:
access: | public
#### Parameters:
string | $value |
[ Top ] ### static method setCurrencyCode [line 691]
`static void setCurrencyCode( [string $pValue = '$'])`
Set the currency code. Only used by PHPExcel_Style_NumberFormat::toFormattedString() to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF #### Tags:
access: | public
#### Parameters:
string | $pValue | Character for currency code
[ Top ] ### static method setDecimalSeparator [line 632]
`static void setDecimalSeparator( [string $pValue = '.'])`
Set the decimal separator. Only used by PHPExcel_Style_NumberFormat::toFormattedString() to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF #### Tags:
access: | public
#### Parameters:
string | $pValue | Character for decimal separator
[ Top ] ### static method setThousandsSeparator [line 659]
`static void setThousandsSeparator( [string $pValue = ','])`
Set the thousands separator. Only used by PHPExcel_Style_NumberFormat::toFormattedString() to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF #### Tags:
access: | public
#### Parameters:
string | $pValue | Character for thousands separator
[ Top ] ### static method Substring [line 573]
`static string Substring( [string $pValue = ''], [ $pStart = 0], [ $pLength = 0], int $start, int $length)`
Get a substring of a UTF-8 encoded string #### Tags:
access: | public
#### Parameters:
string | $pValue | UTF-8 encoded string
int | $start | Start offset
int | $length | Maximum number of characters in substring
| $pStart |
| $pLength |
[ Top ] ### static method SYLKtoUTF8 [line 702]
`static string SYLKtoUTF8( [string $pValue = ''])`
Convert SYLK encoded string to UTF-8 #### Tags:
return: | UTF-8 encoded string
access: | public
#### Parameters:
string | $pValue |
[ Top ] ### static method testStringAsNumeric [line 723]
`static mixed testStringAsNumeric( string $value)`
Retrieve any leading numeric part of a string, or return the full string if no leading numeric (handles basic integer or float, but not exponent or non decimal) #### Tags:
return: | string or only the leading numeric part of the string
access: | public
#### Parameters:
string | $value |
[ Top ] ### static method UTF8toBIFF8UnicodeLong [line 469]
`static string UTF8toBIFF8UnicodeLong( string $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. 2.5.3 #### Tags:
access: | public
#### Parameters:
string | $value | UTF-8 encoded string
[ Top ] ### static method UTF8toBIFF8UnicodeShort [line 433]
`static string UTF8toBIFF8UnicodeShort( string $value, [ $arrcRuns = array()])`
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 #### Tags:
access: | public
#### Parameters:
string | $value | UTF-8 encoded string
| $arrcRuns |
[ Top ] ### static method utf16_decode [line 528]
`static string utf16_decode( string $str, [ $bom_be = true])`
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. #### Tags:
return: | UTF-8 / ISO encoded data.
author: | vadik56
author: | Rasmus Andersson http://rasmusandersson.se/
version: | 0.2 / 2010-05-13
access: | public
#### Parameters:
string | $str | UTF-16 encoded data to decode.
| $bom_be |
[ Top ] ### Class Constants #### STRING_REGEXP_FRACTION = '(-?)(\d+)\s+(\d+\/\d+)' [line 41] Regular Expressions [ Top ] Documentation generated on Fri, 12 Oct 2012 00:18:04 +0200 by phpDocumentor 1.4.4