← rtrim operator page · string/rtrim/ds/manual_ex_1

Manual example 1 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

rtrim on values that end with a space, which "may not be visualised" on the page; the input quotes "hello " and "hi ", so the space is data.

Manual:

Whitespace removal, Example 1, output verbatim: "Removes trailing or/and leading whitespace from a string."

Expected:

Me_1 is hello and hi, without the trailing space.

script.vtl ⇩

DS_r := rtrim(DS_1);

input/DS_1.csv ⇩

Id_1Id_2Me_1
1Ahello
2Bhi

input/DS_1.json ⇩

{
  "datasets": [
    {
      "name": "DS_1",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
        {"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
        {"name": "Me_1", "type": "String", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Id_2Me_1
1Ahello
2Bhi

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier"},
        {"name": "Id_2", "type": "String", "role": "Identifier"},
        {"name": "Me_1", "type": "String", "role": "Measure"}
      ]
    }
  ]
}