How change text format

Hello!

I’m looking for an expression for capslock text formatting…
like…
Field name form = ALEXANDRE
then output = Alexandre

Hi, @alexandre2120 Welcome to the n8n community.

I have prepared a small workflow based on your question.

Just copy the below code and paste into the Workflow editor.

{
  "nodes": [
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "content",
              "value": "HELLO"
            }
          ]
        },
        "options": {}
      },
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        780,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "var final = $node[\"Set\"].json[\"content\"];\nfinaltext = final.charAt(0).toUpperCase()+ final.slice(1).toLowerCase();\nitems[0].json.text = finaltext;\nreturn items;\n"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        980,
        300
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "value": "={{$node[\"Function\"].json[\"text\"]}}"
            }
          ]
        },
        "options": {}
      },
      "name": "Set1",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        1180,
        300
      ]
    }
  ],
  "connections": {
    "Set": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function": {
      "main": [
        [
          {
            "node": "Set1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
1 Like

Thank You!

1 Like

Hope it works. Enjoy. :watermelon: