← replace operator page · string/replace/sc_two/leading_word_replaced

Leading word replaced 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

replace(SC_1, SC_2, SC_3) with SC_1 = Hello world, SC_2 = Hello and SC_3 = Hi, where the pattern is the first word.

Manual:

String pattern replacement: "Replaces all the occurrences of a specified string-pattern (pattern1) with another one (pattern2).", as in replace("Hello world", "Hello", "Hi") gives "Hi world".

Expected:

SC_r is Hi world, a String.

script.vtl ⇩

SC_r := replace(SC_1, SC_2, SC_3);

input/scalars.csv ⇩

SC_1SC_2SC_3
Hello worldHelloHi

input/scalars.json ⇩

{
  "scalars": [
    {"name": "SC_1", "type": "String"},
    {"name": "SC_2", "type": "String"},
    {"name": "SC_3", "type": "String"}
  ]
}

expected/scalars.json ⇩

{
  "scalars": [
    {"name": "SC_r", "type": "String", "value": "Hi world"}
  ]
}