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

Static Public Member Functions

static CHARACTER ($character)
 CHARACTER.
static TRIMNONPRINTABLE ($stringValue= '')
 TRIMNONPRINTABLE.
static TRIMSPACES ($stringValue= '')
 TRIMSPACES.
static ASCIICODE ($characters)
 ASCIICODE.
static CONCATENATE ()
 CONCATENATE.
static DOLLAR ($value=0, $decimals=2)
 DOLLAR.
static SEARCHSENSITIVE ($needle, $haystack, $offset=1)
 SEARCHSENSITIVE.
static SEARCHINSENSITIVE ($needle, $haystack, $offset=1)
 SEARCHINSENSITIVE.
static FIXEDFORMAT ($value, $decimals=2, $no_commas=false)
 FIXEDFORMAT.
static LEFT ($value= '', $chars=1)
 LEFT.
static MID ($value= '', $start=1, $chars=null)
 MID.
static RIGHT ($value= '', $chars=1)
 RIGHT.
static STRINGLENGTH ($value= '')
 STRINGLENGTH.
static LOWERCASE ($mixedCaseString)
 LOWERCASE.
static UPPERCASE ($mixedCaseString)
 UPPERCASE.
static PROPERCASE ($mixedCaseString)
 PROPERCASE.
static REPLACE ($oldText= '', $start=1, $chars=null, $newText)
 REPLACE.
static SUBSTITUTE ($text= '', $fromText= '', $toText= '', $instance=0)
 SUBSTITUTE.
static RETURNSTRING ($testValue= '')
 RETURNSTRING.
static TEXTFORMAT ($value, $format)
 TEXTFORMAT.

Static Private Member Functions

static _uniord ($c)

Static Private Attributes

static $_invalidChars = Null

Detailed Description

Definition at line 46 of file TextData.php.

Member Function Documentation

static PHPExcel_Calculation_TextData::_uniord (   $c)
staticprivate

Definition at line 50 of file TextData.php.

References PHPExcel_Calculation_Functions\VALUE().

Referenced by ASCIICODE().

{
if (ord($c{0}) >=0 && ord($c{0}) <= 127)
return ord($c{0});
if (ord($c{0}) >= 192 && ord($c{0}) <= 223)
return (ord($c{0})-192)*64 + (ord($c{1})-128);
if (ord($c{0}) >= 224 && ord($c{0}) <= 239)
return (ord($c{0})-224)*4096 + (ord($c{1})-128)*64 + (ord($c{2})-128);
if (ord($c{0}) >= 240 && ord($c{0}) <= 247)
return (ord($c{0})-240)*262144 + (ord($c{1})-128)*4096 + (ord($c{2})-128)*64 + (ord($c{3})-128);
if (ord($c{0}) >= 248 && ord($c{0}) <= 251)
return (ord($c{0})-248)*16777216 + (ord($c{1})-128)*262144 + (ord($c{2})-128)*4096 + (ord($c{3})-128)*64 + (ord($c{4})-128);
if (ord($c{0}) >= 252 && ord($c{0}) <= 253)
return (ord($c{0})-252)*1073741824 + (ord($c{1})-128)*16777216 + (ord($c{2})-128)*262144 + (ord($c{3})-128)*4096 + (ord($c{4})-128)*64 + (ord($c{5})-128);
if (ord($c{0}) >= 254 && ord($c{0}) <= 255) //error
return 0;
} // function _uniord()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_TextData::ASCIICODE (   $characters)
static

ASCIICODE.

Parameters
string$characterValue
Returns
int

Definition at line 135 of file TextData.php.

References _uniord(), PHPExcel_Calculation_Functions\COMPATIBILITY_OPENOFFICE, PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\getCompatibilityMode().

{
if (is_bool($characters)) {
$characters = (int) $characters;
} else {
if ($characters) {
$characters = 'True';
} else {
$characters = 'False';
}
}
}
$character = $characters;
if ((function_exists('mb_strlen')) && (function_exists('mb_substr'))) {
if (mb_strlen($characters, 'UTF-8') > 1) { $character = mb_substr($characters, 0, 1, 'UTF-8'); }
return self::_uniord($character);
} else {
if (strlen($characters) > 0) { $character = substr($characters, 0, 1); }
return ord($character);
}
} // function ASCIICODE()

+ Here is the call graph for this function:

static PHPExcel_Calculation_TextData::CHARACTER (   $character)
static

CHARACTER.

Parameters
string$characterValue
Returns
int

Definition at line 74 of file TextData.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\VALUE().

{
if ((!is_numeric($character)) || ($character < 0)) {
}
if (function_exists('mb_convert_encoding')) {
return mb_convert_encoding('&#'.intval($character).';', 'UTF-8', 'HTML-ENTITIES');
} else {
return chr(intval($character));
}
}

+ Here is the call graph for this function:

static PHPExcel_Calculation_TextData::CONCATENATE ( )
static

CONCATENATE.

Returns
string

Definition at line 165 of file TextData.php.

References $arg, PHPExcel_Calculation_Functions\COMPATIBILITY_OPENOFFICE, PHPExcel_Calculation_Functions\flattenArray(), and PHPExcel_Calculation_Functions\getCompatibilityMode().

{
// Return value
$returnValue = '';
// Loop through arguments
foreach ($aArgs as $arg) {
if (is_bool($arg)) {
$arg = (int) $arg;
} else {
if ($arg) {
$arg = 'TRUE';
} else {
$arg = 'FALSE';
}
}
}
$returnValue .= $arg;
}
// Return
return $returnValue;
} // function CONCATENATE()

+ Here is the call graph for this function:

static PHPExcel_Calculation_TextData::DOLLAR (   $value = 0,
  $decimals = 2 
)
static

DOLLAR.

This function converts a number to text using currency format, with the decimals rounded to the specified place. The format used is $#,##0.00_);($#,##0.00)..

Parameters
float$valueThe value to format
int$decimalsThe number of digits to display to the right of the decimal point. If decimals is negative, number is rounded to the left of the decimal point. If you omit decimals, it is assumed to be 2
Returns
string

Definition at line 203 of file TextData.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_MathTrig\MROUND(), and PHPExcel_Calculation_Functions\NaN().

{
$decimals = is_null($decimals) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($decimals);
// Validate parameters
if (!is_numeric($value) || !is_numeric($decimals)) {
}
$decimals = floor($decimals);
if ($decimals > 0) {
return money_format('%.'.$decimals.'n',$value);
} else {
$round = pow(10,abs($decimals));
if ($value < 0) { $round = 0-$round; }
$value = PHPExcel_Calculation_MathTrig::MROUND($value,$round);
// The implementation of money_format used if the standard PHP function is not available can't handle decimal places of 0,
// so we display to 1 dp and chop off that character and the decimal separator using substr
return substr(money_format('%.1n',$value),0,-2);
}
} // function DOLLAR()

+ Here is the call graph for this function:

static PHPExcel_Calculation_TextData::FIXEDFORMAT (   $value,
  $decimals = 2,
  $no_commas = false 
)
static

FIXEDFORMAT.

Parameters
mixed$valueValue to check
Returns
boolean

Definition at line 298 of file TextData.php.

References PHPExcel_Calculation_Functions\flattenSingleValue().

{
$valueResult = round($value,$decimals);
if ($decimals < 0) { $decimals = 0; }
if (!$no_commas) {
$valueResult = number_format($valueResult,$decimals);
}
return (string) $valueResult;
} // function FIXEDFORMAT()

+ Here is the call graph for this function:

static PHPExcel_Calculation_TextData::LEFT (   $value = '',
  $chars = 1 
)
static

LEFT.

Parameters
string$valueValue
int$charsNumber of characters
Returns
string

Definition at line 320 of file TextData.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\VALUE().

Referenced by REPLACE().

{
if ($chars < 0) {
}
if (is_bool($value)) {
$value = ($value) ? 'TRUE' : 'FALSE';
}
if (function_exists('mb_substr')) {
return mb_substr($value, 0, $chars, 'UTF-8');
} else {
return substr($value, 0, $chars);
}
} // function LEFT()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_TextData::LOWERCASE (   $mixedCaseString)
static

LOWERCASE.

Converts a string value to upper case.

Parameters
string$mixedCaseString
Returns
string

Definition at line 426 of file TextData.php.

References PHPExcel_Calculation_Functions\flattenSingleValue().

{
$mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
if (is_bool($mixedCaseString)) {
$mixedCaseString = ($mixedCaseString) ? 'TRUE' : 'FALSE';
}
if (function_exists('mb_convert_case')) {
return mb_convert_case($mixedCaseString, MB_CASE_LOWER, 'UTF-8');
} else {
return strtoupper($mixedCaseString);
}
} // function LOWERCASE()

+ Here is the call graph for this function:

static PHPExcel_Calculation_TextData::MID (   $value = '',
  $start = 1,
  $chars = null 
)
static

MID.

Parameters
string$valueValue
int$startStart character
int$charsNumber of characters
Returns
string

Definition at line 348 of file TextData.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\VALUE().

{
if (($start < 1) || ($chars < 0)) {
}
if (is_bool($value)) {
$value = ($value) ? 'TRUE' : 'FALSE';
}
if (function_exists('mb_substr')) {
return mb_substr($value, --$start, $chars, 'UTF-8');
} else {
return substr($value, --$start, $chars);
}
} // function MID()

+ Here is the call graph for this function:

static PHPExcel_Calculation_TextData::PROPERCASE (   $mixedCaseString)
static

PROPERCASE.

Converts a string value to upper case.

Parameters
string$mixedCaseString
Returns
string

Definition at line 472 of file TextData.php.

References PHPExcel_Calculation_Functions\flattenSingleValue().

{
$mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
if (is_bool($mixedCaseString)) {
$mixedCaseString = ($mixedCaseString) ? 'TRUE' : 'FALSE';
}
if (function_exists('mb_convert_case')) {
return mb_convert_case($mixedCaseString, MB_CASE_TITLE, 'UTF-8');
} else {
return ucwords($mixedCaseString);
}
} // function PROPERCASE()

+ Here is the call graph for this function:

static PHPExcel_Calculation_TextData::REPLACE (   $oldText = '',
  $start = 1,
  $chars = null,
  $newText 
)
static

REPLACE.

Parameters
string$valueValue
int$startStart character
int$charsNumber of characters
Returns
string

Definition at line 495 of file TextData.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), LEFT(), and RIGHT().

Referenced by SUBSTITUTE().

{
$left = self::LEFT($oldText,$start-1);
$right = self::RIGHT($oldText,self::STRINGLENGTH($oldText)-($start+$chars)+1);
return $left.$newText.$right;
} // function REPLACE()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_TextData::RETURNSTRING (   $testValue = '')
static

RETURNSTRING.

Parameters
mixed$valueValue to check
Returns
boolean

Definition at line 561 of file TextData.php.

References PHPExcel_Calculation_Functions\flattenSingleValue().

{
if (is_string($testValue)) {
return $testValue;
}
return Null;
} // function RETURNSTRING()

+ Here is the call graph for this function:

static PHPExcel_Calculation_TextData::RIGHT (   $value = '',
  $chars = 1 
)
static

RIGHT.

Parameters
string$valueValue
int$charsNumber of characters
Returns
string

Definition at line 376 of file TextData.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\VALUE().

Referenced by REPLACE().

{
if ($chars < 0) {
}
if (is_bool($value)) {
$value = ($value) ? 'TRUE' : 'FALSE';
}
if ((function_exists('mb_substr')) && (function_exists('mb_strlen'))) {
return mb_substr($value, mb_strlen($value, 'UTF-8') - $chars, $chars, 'UTF-8');
} else {
return substr($value, strlen($value) - $chars);
}
} // function RIGHT()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_TextData::SEARCHINSENSITIVE (   $needle,
  $haystack,
  $offset = 1 
)
static

SEARCHINSENSITIVE.

Parameters
string$needleThe string to look for
string$haystackThe string in which to look
int$offsetOffset within $haystack
Returns
string

Definition at line 267 of file TextData.php.

References $pos, PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\VALUE().

{
if (!is_bool($needle)) {
if (is_bool($haystack)) {
$haystack = ($haystack) ? 'TRUE' : 'FALSE';
}
if (($offset > 0) && (strlen($haystack) > $offset)) {
if (function_exists('mb_stripos')) {
$pos = mb_stripos($haystack, $needle, --$offset,'UTF-8');
} else {
$pos = stripos($haystack, $needle, --$offset);
}
if ($pos !== false) {
return ++$pos;
}
}
}
} // function SEARCHINSENSITIVE()

+ Here is the call graph for this function:

static PHPExcel_Calculation_TextData::SEARCHSENSITIVE (   $needle,
  $haystack,
  $offset = 1 
)
static

SEARCHSENSITIVE.

Parameters
string$needleThe string to look for
string$haystackThe string in which to look
int$offsetOffset within $haystack
Returns
string

Definition at line 234 of file TextData.php.

References $pos, PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\VALUE().

{
if (!is_bool($needle)) {
if (is_bool($haystack)) {
$haystack = ($haystack) ? 'TRUE' : 'FALSE';
}
if (($offset > 0) && (strlen($haystack) > $offset)) {
if (function_exists('mb_strpos')) {
$pos = mb_strpos($haystack, $needle, --$offset,'UTF-8');
} else {
$pos = strpos($haystack, $needle, --$offset);
}
if ($pos !== false) {
return ++$pos;
}
}
}
} // function SEARCHSENSITIVE()

+ Here is the call graph for this function:

static PHPExcel_Calculation_TextData::STRINGLENGTH (   $value = '')
static

STRINGLENGTH.

Parameters
string$valueValue
int$charsNumber of characters
Returns
string

Definition at line 403 of file TextData.php.

References PHPExcel_Calculation_Functions\flattenSingleValue().

{
if (is_bool($value)) {
$value = ($value) ? 'TRUE' : 'FALSE';
}
if (function_exists('mb_strlen')) {
return mb_strlen($value, 'UTF-8');
} else {
return strlen($value);
}
} // function STRINGLENGTH()

+ Here is the call graph for this function:

static PHPExcel_Calculation_TextData::SUBSTITUTE (   $text = '',
  $fromText = '',
  $toText = '',
  $instance = 0 
)
static

SUBSTITUTE.

Parameters
string$textValue
string$fromTextFrom Value
string$toTextTo Value
integer$instanceInstance Number
Returns
string

Definition at line 517 of file TextData.php.

References $pos, PHPExcel_Calculation_Functions\flattenSingleValue(), and REPLACE().

{
if ($instance == 0) {
if(function_exists('mb_str_replace')) {
return mb_str_replace($fromText,$toText,$text);
} else {
return str_replace($fromText,$toText,$text);
}
} else {
$pos = -1;
while($instance > 0) {
if (function_exists('mb_strpos')) {
$pos = mb_strpos($text, $fromText, $pos+1, 'UTF-8');
} else {
$pos = strpos($text, $fromText, $pos+1);
}
if ($pos === false) {
break;
}
--$instance;
}
if ($pos !== false) {
if (function_exists('mb_strlen')) {
return self::REPLACE($text,++$pos,mb_strlen($fromText, 'UTF-8'),$toText);
} else {
return self::REPLACE($text,++$pos,strlen($fromText),$toText);
}
}
}
return $left.$newText.$right;
} // function SUBSTITUTE()

+ Here is the call graph for this function:

static PHPExcel_Calculation_TextData::TEXTFORMAT (   $value,
  $format 
)
static

TEXTFORMAT.

Parameters
mixed$valueValue to check
Returns
boolean

Definition at line 577 of file TextData.php.

References PHPExcel_Calculation_DateTime\DATEVALUE(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Shared_Date\isDateTimeFormatCode(), and PHPExcel_Style_NumberFormat\toFormattedString().

{
if ((is_string($value)) && (!is_numeric($value)) && PHPExcel_Shared_Date::isDateTimeFormatCode($format)) {
}
return (string) PHPExcel_Style_NumberFormat::toFormattedString($value,$format);
} // function TEXTFORMAT()

+ Here is the call graph for this function:

static PHPExcel_Calculation_TextData::TRIMNONPRINTABLE (   $stringValue = '')
static

TRIMNONPRINTABLE.

Parameters
mixed$valueValue to check
Returns
string

Definition at line 95 of file TextData.php.

References PHPExcel_Calculation_Functions\flattenSingleValue().

{
if (is_bool($stringValue)) {
$stringValue = ($stringValue) ? 'TRUE' : 'FALSE';
}
if (self::$_invalidChars == Null) {
self::$_invalidChars = range(chr(0),chr(31));
}
if (is_string($stringValue) || is_numeric($stringValue)) {
return str_replace(self::$_invalidChars,'',trim($stringValue,"\x00..\x1F"));
}
return Null;
} // function TRIMNONPRINTABLE()

+ Here is the call graph for this function:

static PHPExcel_Calculation_TextData::TRIMSPACES (   $stringValue = '')
static

TRIMSPACES.

Parameters
mixed$valueValue to check
Returns
string

Definition at line 119 of file TextData.php.

References PHPExcel_Calculation_Functions\flattenSingleValue().

{
if (is_string($stringValue) || is_numeric($stringValue)) {
return trim(preg_replace('/ +/',' ',$stringValue));
}
return Null;
} // function TRIMSPACES()

+ Here is the call graph for this function:

static PHPExcel_Calculation_TextData::UPPERCASE (   $mixedCaseString)
static

UPPERCASE.

Converts a string value to upper case.

Parameters
string$mixedCaseString
Returns
string

Definition at line 449 of file TextData.php.

References PHPExcel_Calculation_Functions\flattenSingleValue().

{
$mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
if (is_bool($mixedCaseString)) {
$mixedCaseString = ($mixedCaseString) ? 'TRUE' : 'FALSE';
}
if (function_exists('mb_convert_case')) {
return mb_convert_case($mixedCaseString, MB_CASE_UPPER, 'UTF-8');
} else {
return strtoupper($mixedCaseString);
}
} // function UPPERCASE()

+ Here is the call graph for this function:

Field Documentation

PHPExcel_Calculation_TextData::$_invalidChars = Null
staticprivate

Definition at line 48 of file TextData.php.


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