Split text

Hi

I have a string “docu? An example of text” I would next split this text and only return “An example of text”

I have tried following but it don’t work

var content = “docu? food”
content.split("?")[1].trim()

Hey @Mattias_Larsson .

Could you please elaborate more? are you using a function node? what do you want to do exactly? like the whole use case.

HI yes i am trying to use the function node.

I have an incoming string with the text “docu? this is an example text” and i need a function node to split the text so i only get an output the part “this is an example text”. I want to use that later in a web-request

@Mattias_Larsson copy and paste the example below:

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "items[0].json.incomingText = 'docu? this is an example text';\nreturn items;"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        480,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "const text = items[0].json.incomingText.split('?')[1]\nreturn [\n  {\n    json: { textSplited: text } \n  }\n]\n\n"
      },
      "name": "Function1",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        660,
        300
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function": {
      "main": [
        [
          {
            "node": "Function1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
2 Likes

Tank you , really appreciated, and marry Christmas.

1 Like

Hi @RicardoE105

How would i call in some output from a set node?

So i am trying to pull in amsURL and take this string and strip the https://. from it and use that in credentials