← length operator page · string/length/sc/punctuation_and_space_counted

Punctuation and space counted 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

length(SC_1) with SC_1 = Hello, World!, a string with a comma, a space and an exclamation mark.

Manual:

String length: "Returns the length of a string.", and length("Hello, World!") gives 13.

Expected:

SC_r is 13, an Integer: Hello is 5, ", " is 2, World is 5 and ! is 1.

script.vtl ⇩

SC_r := length(SC_1);

input/scalars.csv ⇩

SC_1
Hello, World!

input/scalars.json ⇩

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

expected/scalars.json ⇩

{
  "scalars": [
    {"name": "SC_r", "type": "Integer", "value": 13}
  ]
}