Documentation

Extract
in package
uses ArrayEnabled

Table of Contents

Properties

$arrayArgumentHelper  : ArrayArgumentHelper
$initializationNeeded  : bool

Methods

after()  : array<string|int, mixed>|string
TEXTAFTER.
before()  : array<string|int, mixed>|string
TEXTBEFORE.
left()  : array<string|int, mixed>|string
LEFT.
mid()  : array<string|int, mixed>|string
MID.
right()  : array<string|int, mixed>|string
RIGHT.
evaluateArrayArguments()  : array<string|int, mixed>
Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument.
evaluateArrayArgumentsIgnore()  : array<string|int, mixed>
Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument except for the one specified by ignore.
evaluateArrayArgumentsSubset()  : array<string|int, mixed>
Handles array argument processing when the function accepts multiple arguments, but only the first few (up to limit) can be an array arguments.
evaluateArrayArgumentsSubsetFrom()  : array<string|int, mixed>
Handles array argument processing when the function accepts multiple arguments, but only the last few (from start) can be an array arguments.
evaluateSingleArgumentArray()  : array<string|int, mixed>
Handles array argument processing when the function accepts a single argument that can be an array argument.
buildDelimiter()  : string
initialiseHelper()  : void
matchFlags()  : string
testFalse()  : bool
validateTextBeforeAfter()  : array<string|int, mixed>|string

Properties

$initializationNeeded

private static bool $initializationNeeded = true

Methods

after()

TEXTAFTER.

public static after(mixed $text, null|array<string|int, mixed>|string $delimiter[, mixed $instance = 1 ][, mixed $matchMode = 0 ][, mixed $matchEnd = 0 ][, mixed $ifNotFound = '#N/A' ]) : array<string|int, mixed>|string
Parameters
$text : mixed

the text that you're searching

$delimiter : null|array<string|int, mixed>|string

the text that marks the point before which you want to extract Multiple delimiters can be passed as an array of string values

$instance : mixed = 1

The instance of the delimiter after which you want to extract the text. By default, this is the first instance (1). A negative value means start searching from the end of the text string. Or can be an array of values

$matchMode : mixed = 0

Determines whether the match is case-sensitive or not. 0 - Case-sensitive 1 - Case-insensitive Or can be an array of values

$matchEnd : mixed = 0

Treats the end of text as a delimiter. 0 - Don't match the delimiter against the end of the text. 1 - Match the delimiter against the end of the text. Or can be an array of values

$ifNotFound : mixed = '#N/A'

value to return if no match is found The default is a #N/A Error Or can be an array of values

Return values
array<string|int, mixed>|string

the string extracted from text before the delimiter; or the $ifNotFound value If an array of values is passed for any of the arguments, then the returned result will also be an array with matching dimensions

before()

TEXTBEFORE.

public static before(mixed $text, null|array<string|int, mixed>|string $delimiter[, mixed $instance = 1 ][, mixed $matchMode = 0 ][, mixed $matchEnd = 0 ][, mixed $ifNotFound = '#N/A' ]) : array<string|int, mixed>|string
Parameters
$text : mixed

the text that you're searching Or can be an array of values

$delimiter : null|array<string|int, mixed>|string

the text that marks the point before which you want to extract Multiple delimiters can be passed as an array of string values

$instance : mixed = 1

The instance of the delimiter after which you want to extract the text. By default, this is the first instance (1). A negative value means start searching from the end of the text string. Or can be an array of values

$matchMode : mixed = 0

Determines whether the match is case-sensitive or not. 0 - Case-sensitive 1 - Case-insensitive Or can be an array of values

$matchEnd : mixed = 0

Treats the end of text as a delimiter. 0 - Don't match the delimiter against the end of the text. 1 - Match the delimiter against the end of the text. Or can be an array of values

$ifNotFound : mixed = '#N/A'

value to return if no match is found The default is a #N/A Error Or can be an array of values

Return values
array<string|int, mixed>|string

the string extracted from text before the delimiter; or the $ifNotFound value If an array of values is passed for any of the arguments, then the returned result will also be an array with matching dimensions

left()

LEFT.

public static left(mixed $value[, mixed $chars = 1 ]) : array<string|int, mixed>|string
Parameters
$value : mixed

String value from which to extract characters Or can be an array of values

$chars : mixed = 1

The number of characters to extract (as an integer) Or can be an array of values

Return values
array<string|int, mixed>|string

The joined string If an array of values is passed for the $value or $chars arguments, then the returned result will also be an array with matching dimensions

mid()

MID.

public static mid(mixed $value, mixed $start, mixed $chars) : array<string|int, mixed>|string
Parameters
$value : mixed

String value from which to extract characters Or can be an array of values

$start : mixed

Integer offset of the first character that we want to extract Or can be an array of values

$chars : mixed

The number of characters to extract (as an integer) Or can be an array of values

Return values
array<string|int, mixed>|string

The joined string If an array of values is passed for the $value, $start or $chars arguments, then the returned result will also be an array with matching dimensions

right()

RIGHT.

public static right(mixed $value[, mixed $chars = 1 ]) : array<string|int, mixed>|string
Parameters
$value : mixed

String value from which to extract characters Or can be an array of values

$chars : mixed = 1

The number of characters to extract (as an integer) Or can be an array of values

Return values
array<string|int, mixed>|string

The joined string If an array of values is passed for the $value or $chars arguments, then the returned result will also be an array with matching dimensions

evaluateArrayArguments()

Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument.

protected static evaluateArrayArguments(callable $method, mixed ...$arguments) : array<string|int, mixed>

Example use for: ROUND() or DATE().

Parameters
$method : callable
$arguments : mixed
Return values
array<string|int, mixed>

evaluateArrayArgumentsIgnore()

Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument except for the one specified by ignore.

protected static evaluateArrayArgumentsIgnore(callable $method, int $ignore, mixed ...$arguments) : array<string|int, mixed>

Example use for: HLOOKUP() and VLOOKUP(), where argument 1 is a matrix that needs to be treated as a database rather than as an array argument.

Parameters
$method : callable
$ignore : int
$arguments : mixed
Return values
array<string|int, mixed>

evaluateArrayArgumentsSubset()

Handles array argument processing when the function accepts multiple arguments, but only the first few (up to limit) can be an array arguments.

protected static evaluateArrayArgumentsSubset(callable $method, int $limit, mixed ...$arguments) : array<string|int, mixed>

Example use for: NETWORKDAYS() or CONCATENATE(), where the last argument is a matrix (or a series of values) that need to be treated as a such rather than as an array arguments.

Parameters
$method : callable
$limit : int
$arguments : mixed
Return values
array<string|int, mixed>

evaluateArrayArgumentsSubsetFrom()

Handles array argument processing when the function accepts multiple arguments, but only the last few (from start) can be an array arguments.

protected static evaluateArrayArgumentsSubsetFrom(callable $method, int $start, mixed ...$arguments) : array<string|int, mixed>

Example use for: Z.TEST() or INDEX(), where the first argument 1 is a matrix that needs to be treated as a dataset rather than as an array argument.

Parameters
$method : callable
$start : int
$arguments : mixed
Return values
array<string|int, mixed>

evaluateSingleArgumentArray()

Handles array argument processing when the function accepts a single argument that can be an array argument.

protected static evaluateSingleArgumentArray(callable $method, array<string|int, mixed> $values) : array<string|int, mixed>

Example use for: DAYOFMONTH() or FACT().

Parameters
$method : callable
$values : array<string|int, mixed>
Return values
array<string|int, mixed>

buildDelimiter()

private static buildDelimiter(null|array<string|int, mixed>|string $delimiter) : string
Parameters
$delimiter : null|array<string|int, mixed>|string

the text that marks the point before which you want to extract Multiple delimiters can be passed as an array of string values

Return values
string

initialiseHelper()

private static initialiseHelper(array<string|int, mixed>|false $arguments) : void
Parameters
$arguments : array<string|int, mixed>|false

Can be changed to array for Php8.1+

matchFlags()

private static matchFlags(int $matchMode) : string
Parameters
$matchMode : int
Return values
string

testFalse()

private static testFalse(mixed $value) : bool
Parameters
$value : mixed
Return values
bool

validateTextBeforeAfter()

private static validateTextBeforeAfter(string $text, null|array<string|int, mixed>|string $delimiter, int $instance, int $matchMode, int $matchEnd, mixed $ifNotFound) : array<string|int, mixed>|string
Parameters
$text : string
$delimiter : null|array<string|int, mixed>|string
$instance : int
$matchMode : int
$matchEnd : int
$ifNotFound : mixed
Return values
array<string|int, mixed>|string

        
On this page

Search results