PHPExcel_Shared_String

category PHPExcel
package PHPExcel_Shared
copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)

 Methods

Convert from OpenXML escaped control character to PHP control character

ControlCharacterOOXML2PHP(string $value) : string
Static

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 () element or in the shared string element.

Parameters

$value

string

Value to unescape

Returns

string

Convert from PHP control character to OpenXML escaped control character

ControlCharacterPHP2OOXML(string $value) : string
Static

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 () element or in the shared string element.

Parameters

$value

string

Value to escape

Returns

string

Convert string from one encoding to another.

ConvertEncoding(string $value, string $to, string $from) : string
Static

First try mbstring, then iconv, finally strlen

Parameters

$value

string

$to

string

Encoding to convert to, e.g. 'UTF-8'

$from

string

Encoding to convert from, e.g. 'UTF-16LE'

Returns

string

Get character count.

CountCharacters(string $value, string $enc) : int
Static

First try mbstring, then iconv, finally strlen

Parameters

$value

string

$enc

string

Encoding

Returns

intCharacter count

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.

FormatNumber(mixed $value) : string
Static

Parameters

$value

mixed

Returns

string

Check if a string contains UTF8 data

IsUTF8(string $value) : boolean
Static

Parameters

$value

string

Returns

boolean

Convert SYLK encoded string to UTF-8

SYLKtoUTF8(string $pValue) : string
Static

Parameters

$pValue

string

Returns

stringUTF-8 encoded string

Try to sanitize UTF8, stripping invalid byte sequences.

SanitizeUTF8(string $value) : string
Static

Not perfect. Does not surrogate characters.

Parameters

$value

string

Returns

string

Convert a UTF-8 encoded string to lower case

StrToLower(string $pValue) : string
Static

Parameters

$pValue

string

UTF-8 encoded string

Returns

string

Convert a UTF-8 encoded string to title/proper case (uppercase every first character in each word, lower case all other characters)

StrToTitle(string $pValue) : string
Static

Parameters

$pValue

string

UTF-8 encoded string

Returns

string

Convert a UTF-8 encoded string to upper case

StrToUpper(string $pValue) : string
Static

Parameters

$pValue

string

UTF-8 encoded string

Returns

string

Get a substring of a UTF-8 encoded string.

Substring(string $pValue, int $pStart, int $pLength) : string
Static

First try mbstring, then iconv, finally strlen

Parameters

$pValue

string

UTF-8 encoded string

$pStart

int

Start offset

$pLength

int

Maximum number of characters in substring

Returns

string

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.

UTF8toBIFF8UnicodeLong(string $value) : string
Static

2.5.3

Parameters

$value

string

UTF-8 encoded string

Returns

string

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.

UTF8toBIFF8UnicodeShort(string $value, mixed[] $arrcRuns) : string
Static

2.5.3

Parameters

$value

string

UTF-8 encoded string

$arrcRuns

mixed[]

Details of rich text runs in $value

Returns

string

buildCharacterSets()

buildCharacterSets() 
Static

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

convertToNumberIfFraction(string $operand) : boolean
Static

Parameters

$operand

string

&$operand string value to test

Returns

boolean

Get the currency code.

getCurrencyCode() : string
Static

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

Returns

string

Get the decimal separator.

getDecimalSeparator() : string
Static

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

Returns

string

Get whether iconv extension is available

getIsIconvEnabled() : boolean
Static

Returns

boolean

Get whether mbstring extension is available

getIsMbstringEnabled() : boolean
Static

Returns

boolean

Get the thousands separator.

getThousandsSeparator() : string
Static

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

Returns

string

Set the currency code.

setCurrencyCode(string $pValue) 
Static

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

Parameters

$pValue

string

Character for currency code

Set the decimal separator.

setDecimalSeparator(string $pValue) 
Static

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

Parameters

$pValue

string

Character for decimal separator

Set the thousands separator.

setThousandsSeparator(string $pValue) 
Static

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

Parameters

$pValue

string

Character for thousands separator

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)

testStringAsNumeric(string $value) : mixed
Static

Parameters

$value

string

Returns

mixedstring or only the leading numeric part of the string

Decode UTF-16 encoded strings.

utf16_decode(string $str, $bom_be) : string
Static

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.

access public
version 0.2 / 2010-05-13
author Rasmus Andersson {@link http://rasmusandersson.se/}
author vadik56

Parameters

$str

string

UTF-16 encoded data to decode.

$bom_be

Returns

stringUTF-8 / ISO encoded data.

Build control characters array

_buildControlCharacters() 
Static

Build SYLK characters array

_buildSYLKCharacters() 
Static

 Properties

 

$_SYLKCharacters 

$var array

 

$_controlCharacters : string[]
 

$_currencyCode : string
 

$_decimalSeparator : string
 

$_isIconvEnabled : boolean
 

$_isMbstringEnabled : boolean
 

$_thousandsSeparator : string

 Constants

 

STRING_REGEXP_FRACTION

STRING_REGEXP_FRACTION