The backslash escape doesn’t work. I use a string node, but I wonder how to do this in a code block.
That seems to be a bug in the Code Block, it should process a semicolon only if it is outside quotes. A String node is the only way, I’m afraid.
Tested in Dynamo 3.2
- Enter
";";
in a code block - place cursor at the end of 1st line and press
suppr
Hi @Anton_Huizinga , even if its in next line, still its considered as a string with single line. Attached the snap for reference
It adds a new line character to it. And it doesn’t look well inside the Code Block.
But if one really don’t want to work with the String node, it is an option, especially with the Trim function:
And sometimes, semicolons are used when you import data from CSV or so. Then you will loose the columns.
The issue here seems to be that Dynamo is still automatically adding a linebreak like the semi-colon isn’t part of the string but still respecting the string characters. Removing the linebreak after it’s added fixes the problem. Not sure if this has been caught yet, so it’s worth submitting as a bug fix. Good find.
New Issue · DynamoDS/Dynamo
In 2015 is was added to the list but propably lost somewhere.
Already picked up by @Vikram_Subbaiah in 2021 here Semi Colon as String in Code Block · Issue #12152 · DynamoDS/Dynamo · GitHub
And here’s the offending code Dynamo/src/DynamoCore/Graph/Nodes/CodeBlockUtils.cs at 3e2036956206d9f16126c73cbf3a612ec444da83 · DynamoDS/Dynamo · GitHub