Overview

Packages

  • JAMA
  • None
  • PHP
  • PHPExcel
    • CachedObjectStorage
    • Calculation
    • Cell
    • Chart
      • Renderer
    • Reader
      • Excel2007
      • Excel5
    • RichText
    • Settings
    • Shared
      • Escher
      • OLE
      • Trend
      • ZipArchive
    • Style
    • Worksheet
      • Drawing
    • Writer
      • 2007
      • CSV
      • Excel2007
      • Excel5
      • HTML
      • PDF

Classes

  • PHPExcel_Shared_CodePage
  • PHPExcel_Shared_Date
  • PHPExcel_Shared_Drawing
  • PHPExcel_Shared_Excel5
  • PHPExcel_Shared_File
  • PHPExcel_Shared_Font
  • PHPExcel_Shared_OLERead
  • PHPExcel_Shared_PasswordHasher
  • PHPExcel_Shared_String
  • PHPExcel_Shared_TimeZone
  • PHPExcel_Shared_XMLWriter
  • PHPExcel_Shared_ZipStreamWrapper
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  • Download

Class PHPExcel_Shared_String

PHPExcel_Shared_String

Package: PHPExcel\Shared
Category: PHPExcel
Copyright: Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
License: LGPL
Located at controlador/include/phpexcel/PHPExcel/Shared/String.php
Methods summary
private static
# _buildControlCharacters( )

Build control characters array

Build control characters array

private static
# _buildSYLKCharacters( )

Build SYLK characters array

Build SYLK characters array

public static boolean
# getIsMbstringEnabled( )

Get whether mbstring extension is available

Get whether mbstring extension is available

Returns

boolean
public static boolean
# getIsIconvEnabled( )

Get whether iconv extension is available

Get whether iconv extension is available

Returns

boolean
public static
# buildCharacterSets( )
public static string
# ControlCharacterOOXML2PHP( string $value = '' )

Convert from OpenXML escaped control character to PHP control character

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

Parameters

$value
Value to unescape

Returns

string
public static string
# ControlCharacterPHP2OOXML( string $value = '' )

Convert from PHP control character to OpenXML escaped control character

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

Parameters

$value
Value to escape

Returns

string
public static string
# SanitizeUTF8( string $value )

Try to sanitize UTF8, stripping invalid byte sequences. Not perfect. Does not surrogate characters.

Try to sanitize UTF8, stripping invalid byte sequences. Not perfect. Does not surrogate characters.

Parameters

$value

Returns

string
public static boolean
# IsUTF8( string $value = '' )

Check if a string contains UTF8 data

Check if a string contains UTF8 data

Parameters

$value

Returns

boolean
public 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.

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

$value

Returns

string
public static string
# UTF8toBIFF8UnicodeShort( string $value, mixed[] $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

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

$value
UTF-8 encoded string
$arrcRuns
Details of rich text runs in $value

Returns

string
public 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

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

$value
UTF-8 encoded string

Returns

string
public static string
# ConvertEncoding( string $value, string $to, string $from )

Convert string from one encoding to another. First try mbstring, then iconv, finally strlen

Convert string from one encoding to another. First try mbstring, then iconv, finally strlen

Parameters

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

Returns

string
public static string
# utf16_decode( string $str, $bom_be = TRUE )

Decode UTF-16 encoded strings.

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

$str
UTF-16 encoded data to decode.
$bom_be

Returns

string
UTF-8 / ISO encoded data.

Author

Rasmus Andersson http://rasmusandersson.se/
vadik56

Version

0.2 / 2010-05-13
public static integer
# CountCharacters( string $value, string $enc = 'UTF-8' )

Get character count. First try mbstring, then iconv, finally strlen

Get character count. First try mbstring, then iconv, finally strlen

Parameters

$value
$enc
Encoding

Returns

integer
Character count
public static string
# Substring( string $pValue = '', integer $pStart = 0, integer $pLength = 0 )

Get a substring of a UTF-8 encoded string. First try mbstring, then iconv, finally strlen

Get a substring of a UTF-8 encoded string. First try mbstring, then iconv, finally strlen

Parameters

$pValue
UTF-8 encoded string
$pStart
Start offset
$pLength
Maximum number of characters in substring

Returns

string
public static string
# StrToUpper( string $pValue = '' )

Convert a UTF-8 encoded string to upper case

Convert a UTF-8 encoded string to upper case

Parameters

$pValue
UTF-8 encoded string

Returns

string
public static string
# StrToLower( string $pValue = '' )

Convert a UTF-8 encoded string to lower case

Convert a UTF-8 encoded string to lower case

Parameters

$pValue
UTF-8 encoded string

Returns

string
public static string
# StrToTitle( string $pValue = '' )

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

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

Parameters

$pValue
UTF-8 encoded string

Returns

string
public static boolean
# convertToNumberIfFraction( string & $operand )

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

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

Parameters

$operand
$operand string value to test

Returns

boolean
public static string
# getDecimalSeparator( )

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

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

Returns

string
public static
# 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

Set the decimal separator. Only used by PHPExcel_Style_NumberFormat::toFormattedString() to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF

Parameters

$pValue
Character for decimal separator
public static string
# getThousandsSeparator( )

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

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

Returns

string
public static
# 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

Set the thousands separator. Only used by PHPExcel_Style_NumberFormat::toFormattedString() to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF

Parameters

$pValue
Character for thousands separator
public static string
# getCurrencyCode( )

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

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

Returns

string
public static
# 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

Set the currency code. Only used by PHPExcel_Style_NumberFormat::toFormattedString() to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF

Parameters

$pValue
Character for currency code
public static string
# SYLKtoUTF8( string $pValue = '' )

Convert SYLK encoded string to UTF-8

Convert SYLK encoded string to UTF-8

Parameters

$pValue

Returns

string
UTF-8 encoded string
public 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)

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)

Parameters

$value

Returns

mixed
string or only the leading numeric part of the string
Constants summary
string STRING_REGEXP_FRACTION
# '(-?)(\d+)\s+(\d+\/\d+)'
Properties summary
private static string[] $_controlCharacters

Control characters array

Control characters array

# array()
private static array $_SYLKCharacters

SYLK Characters array

SYLK Characters array

$var array

# array()
private static string $_decimalSeparator

Decimal separator

Decimal separator

#
private static string $_thousandsSeparator

Thousands separator

Thousands separator

#
private static string $_currencyCode

Currency code

Currency code

#
private static boolean $_isMbstringEnabled

Is mbstring extension avalable?

Is mbstring extension avalable?

#
private static boolean $_isIconvEnabled

Is iconv extension avalable?

Is iconv extension avalable?

#
Autene API documentation generated by ApiGen