Replace
in package
uses
ArrayEnabled
Table of Contents
Properties
Methods
- replace() : array<string|int, mixed>|string
- REPLACE.
- substitute() : array<string|int, mixed>|string
- SUBSTITUTE.
- 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.
- executeSubstitution() : string
- initialiseHelper() : void
- testFalse() : bool
Properties
$arrayArgumentHelper
private
static ArrayArgumentHelper
$arrayArgumentHelper
$initializationNeeded
private
static bool
$initializationNeeded
= true
Methods
replace()
REPLACE.
public
static replace(mixed $oldText, mixed $start, mixed $chars, mixed $newText) : array<string|int, mixed>|string
Parameters
- $oldText : mixed
-
The text string value to modify Or can be an array of values
- $start : mixed
-
Integer offset for start character of the replacement Or can be an array of values
- $chars : mixed
-
Integer number of characters to replace from the start offset Or can be an array of values
- $newText : mixed
-
String to replace in the defined position Or can be an array of values
Return values
array<string|int, mixed>|string —If an array of values is passed for either of the arguments, then the returned result will also be an array with matching dimensions
substitute()
SUBSTITUTE.
public
static substitute([mixed $text = '' ][, mixed $fromText = '' ][, mixed $toText = '' ][, mixed $instance = null ]) : array<string|int, mixed>|string
Parameters
- $text : mixed = ''
-
The text string value to modify Or can be an array of values
- $fromText : mixed = ''
-
The string value that we want to replace in $text Or can be an array of values
- $toText : mixed = ''
-
The string value that we want to replace with in $text Or can be an array of values
- $instance : mixed = null
-
Integer instance Number for the occurrence of frmText to change Or can be an array of values
Return values
array<string|int, mixed>|string —If an array of values is passed for either of the 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>executeSubstitution()
private
static executeSubstitution(string $text, string $fromText, string $toText, int $instance) : string
Parameters
- $text : string
- $fromText : string
- $toText : string
- $instance : int
Return values
stringinitialiseHelper()
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+
testFalse()
private
static testFalse(mixed $value) : bool
Parameters
- $value : mixed