Skip to content

tuple_str_replaceTupleStrReplaceTupleStrReplacetuple_str_replacetuple_str_replace🔗

Short description🔗

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

Signature🔗

tuple_str_replace( string String, string Before, string After, out string Replaced )void TupleStrReplace( const HTuple& String, const HTuple& Before, const HTuple& After, HTuple* Replaced )static void HOperatorSet.TupleStrReplace( HTuple stringVal, HTuple before, HTuple after, out HTuple replaced )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] ) -> strHerror 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 )

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

HTuple HTuple.TupleStrReplace( HTuple before, HTuple after )

Description🔗

tuple_str_replaceTupleStrReplace replaces all occurrences of Beforebeforebefore in StringstringValstring with Afterafterafter and returns the result in Replacedreplacedreplaced. All three tuples may only consist of strings. Otherwise, tuple_str_replaceTupleStrReplace returns an error. As an exception, an empty tuple in Afterafterafter corresponds to an empty string. Beforebeforebefore and Afterafterafter must contain the same number of elements. They can either contain one element, then Beforebeforebefore is replaced with Afterafterafter in all input strings of the tuple StringstringValstring or they can contain exactly the same number of elements as the tuple StringstringValstring, then the n-th entry in Beforebeforebefore is replaced with the n-th entry in Afterafterafter in the n-th entry of StringstringValstring. The string with all replacements is returned in Replacedreplacedreplaced and contains the same number of elements as StringstringValstring 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_replaceTupleStrReplace, which can be used in an expression in the following syntax:

Replaced := str_replace(String, Before, After)

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

StringstringValstring (input_control) string(-array) → (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Input tuple with string(s) to work on.

Beforebeforebefore (input_control) string(-array) → (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Input tuple with string(s) to search.

Afterafterafter (input_control) string(-array) → (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Input tuple with string(s) to replace Beforebeforebefore.

Replacedreplacedreplaced (output_control) string(-array) → (string)HTuple (HString)HTuple (string)Sequence[str]Htuple (char*)

Output tuple with replaced strings.

Combinations with other operators🔗

Combinations

Alternatives

tuple_regexp_replaceTupleRegexpReplace

Module🔗

Foundation