pub fn apply_str_str<T, U>(
lhs: StringAVT<'_, T>,
rhs: StringAVT<'_, U>,
op: ArithmeticOperator,
) -> Result<StringArray<T>, KernelError>Expand description
Applies an element-wise binary operation between two StringArrays,
producing a new StringArray. Requires both arrays to have the same length.
Supported operations:
Add: Concatenates each pair of strings (a + b).Subtract: Removes the first occurrence ofbfroma, if present. Ifbis empty or not found,ais returned unchanged.Multiply: Repeats stringaN times, whereN = min(b.len(), STRING_MULTIPLICATION_LIMIT).Divide: Splits stringaby occurrences ofband rejoins the segments using a'|'separator. Ifbis empty, returnsaunchanged.
Null handling:
- If either side is null at an index, the output will be null at that index.
Returns:
- A new
StringArray<T>containing the result of applying the binary operation to each pair.
Errors:
- Returns
KernelError::LengthMismatchiflhsandrhslengths differ. - Returns
KernelError::UnsupportedTypeif an unsupported binary operator is passed.
ยงFeatures
This function is available only when the str_arithmetic feature is enabled.