Operator Reference

tuple_str_replacetuple_str_replaceTupleStrReplaceTupleStrReplacetuple_str_replace (Operator)

tuple_str_replacetuple_str_replaceTupleStrReplaceTupleStrReplacetuple_str_replace — Replace all occurrences of a substring within a string.

Signature

tuple_str_replace( : : String, Before, After : Replaced)

Herror tuple_str_replace(const char* String, const char* Before, const char* After, char* Replaced)

Herror T_tuple_str_replace(const Htuple String, const Htuple Before, const Htuple After, Htuple* Replaced)

void TupleStrReplace(const HTuple& String, const HTuple& Before, const HTuple& After, HTuple* Replaced)

HTuple HTuple::TupleStrReplace(const HTuple& Before, const HTuple& After) const

static void HOperatorSet.TupleStrReplace(HTuple stringVal, HTuple before, HTuple after, out HTuple replaced)

HTuple HTuple.TupleStrReplace(HTuple before, HTuple after)

def tuple_str_replace(string: MaybeSequence[str], before: MaybeSequence[str], after: MaybeSequence[str]) -> Sequence[str]

def tuple_str_replace_s(string: MaybeSequence[str], before: MaybeSequence[str], after: MaybeSequence[str]) -> str

Description

tuple_str_replacetuple_str_replaceTupleStrReplaceTupleStrReplacetuple_str_replace replaces all occurrences of BeforeBeforeBeforebeforebefore in StringStringStringstringValstring with AfterAfterAfterafterafter and returns the result in ReplacedReplacedReplacedreplacedreplaced. All three tuples may only consist of strings. Otherwise, tuple_str_replacetuple_str_replaceTupleStrReplaceTupleStrReplacetuple_str_replace returns an error. As an exception, an empty tuple in AfterAfterAfterafterafter corresponds to an empty string. BeforeBeforeBeforebeforebefore and AfterAfterAfterafterafter must contain the same number of elements. They can either contain one element, then BeforeBeforeBeforebeforebefore is replaced with AfterAfterAfterafterafter in all input strings of the tuple StringStringStringstringValstring or they can contain exactly the same number of elements as the tuple StringStringStringstringValstring, then the n-th entry in BeforeBeforeBeforebeforebefore is replaced with the n-th entry in AfterAfterAfterafterafter in the n-th entry of StringStringStringstringValstring. The string with all replacements is returned in ReplacedReplacedReplacedreplacedreplaced and contains the same number of elements as StringStringStringstringValstring in both cases.

For general information about string operations see Tuple / String Operations.

HDevelop In-line Operation

HDevelop provides an in-line operation for tuple_str_replacetuple_str_replaceTupleStrReplaceTupleStrReplacetuple_str_replace, which can be used in an expression in the following syntax:

Replaced := str_replace(String, Before, After)

Execution Information

  • Multithreading type: independent (runs in parallel even with exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Processed without parallelization.

Parameters

StringStringStringstringValstring (input_control)  string(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Input tuple with string(s) to work on.

BeforeBeforeBeforebeforebefore (input_control)  string(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Input tuple with string(s) to search.

AfterAfterAfterafterafter (input_control)  string(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Input tuple with string(s) to replace BeforeBeforeBeforebeforebefore.

ReplacedReplacedReplacedreplacedreplaced (output_control)  string(-array) HTupleSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Output tuple with replaced strings.

Alternatives

tuple_regexp_replacetuple_regexp_replaceTupleRegexpReplaceTupleRegexpReplacetuple_regexp_replace

Module

Foundation