How to simplify code block function

Rather than defining the search strings and then calling them in the function you could just define them in the function itself. You do still need to step through each replacement individually, since Dynamo won’t replace strings recursively like this.

Another option is to pull the string apart and then replace everything at once.

EDIT: You may also be able to simplify things even more with an Imperative block. I don’t have much experience here, so I’m not sure if you can make it any simpler or not.
image

7 Likes