Hello community,
I am sure this is a very easy operation but I am not sure how to do it?
I would like to remove spaces between words, only keep one.
Is there a node that do this?
Hi John,
Thanks for your answer, but what if we need to keep just one?
we can use a conditional statement with a number of possibilities but I dont think this is a smart way, is it?
What do you mean? You can separate strings by spaces.
EDIT: Or do you mean you have excess spaces between words and you need to reduce them down to a single space?
that exactly Nick!
keep only one space in the string between words
in excel there is one operation called trim, I just need the same here in dynamo.
Is there an easy way?
Just take a look at the Dictionary by typing “trim” or “slice” or “split”, it could give you some clues to get started:
http://dictionary.dynamobim.com/#/Core/String/Action/TrimLeadingWhitespace
See also what’s in the Primer about strings:
http://dynamoprimer.com/en/04_The-Building-Blocks-of-Programs/4-4_strings.html
Python would also work really well for this.
https://stackoverflow.com/questions/1546226/a-simple-way-to-remove-multiple-spaces-in-a-string-in-python
Nice, I add it to my favourites, along with this one:
Edit: I just found another good one on this topic:
Hello guys,
Sorry for my ignorance, I am new in dynamo and not familiar with python out of the box node editor.
Can anyone drop the graph here please?
Thank you very much in advance, you are amazing!
We usually would rather take a look at what you have tried and answer the particular issues you encounter in doing it
Hello,
I have tried with all the nodes that you suggested in the dynamo primer, but none works.
Image attached
I have copied the code into a python script node in dynamo but no luck,
Image attached
Is it normal that the sheet names list is empty in your first graph?
String.Split gets you half way there. You just need to join your strings again with a single space.
Thank you very much Nick, really appreciated
it seems to be working fine in dynamo but my sheet name in Revit is not changing,
do you know why, please see image attached
Your String.Join node is giving you a sublist of names. You need to Flatten those values before setting the parameter for each sheet. (You can see all the names are being applied to the same sheet.)
Amazing Nick, thank you very much for your help, you are a star!!!
Share graph just in case need it.
… The exact solution helped me as well: in order to have a multi-line text as room name, i had to add spaces. Then for scheduling, I’ve added a text-based instance parameter to room, which populates with the room name minus the spaces. Long story short, thank you @Nick_Boyts for the solution!