← replace operator page · string/replace/ds_one/replacement_omitted
pandas ✅ · DuckDB ✅
replace(DS_1, "l") with pattern2 omitted.
String pattern replacement: "If pattern2 is omitted then all occurrences of pattern1 are removed."
hello world, which has three l, gives heo word; say has none and is kept. A null operand gives a null result: "most of the scalar operations (arithmetic, logical, and others) return null when any of their arguments is null" (User Manual), as the manual's length and instr examples show.
DS_r := replace(DS_1, "l");
| Id_1 | Me_1 |
|---|---|
| 1 | hello world |
| 2 | say |
| 3 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "String", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 |
|---|---|
| 1 | heo word |
| 2 | say |
| 3 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "String", "role": "Measure"}
]
}
]
}