Uppercase string excluding certain strings

I’m trying to uppercase the names of all the sheets but I need to exclude instances where there is mm (millimeter) or cm in the name. So the result I’m trying to get is that all the sheet names is uppercase except cases where there are mm or cm where the whole name would be uppercase except cm or mm.


This changes the name of the sheets that have mm or cm in the completely instead of excluding the mm/cm part.

Convert all of them completely to uppercase and then replace the CM with cm and the MM with mm with a String.Replace node (or nodes if you can’t manage the lacing and levels).

Good idea, thanks.

Here’s another way.

This doesnt work for me. I have 214 sheets and 50 things to exclude. The outcome is that it searches for the 1st thing to exclude in the 1st sheet name and so on. I even tried to do a nested list but couldn’t figure it out so I just did it the long way. 50 times string replace with the 50 exclusions.

Maybe It can help you.

Have you tried jacobsmall suggestion? If so have you heard the CHAINING on nodes try that…you will get good results automated

This is what I did but it took a lot of time

The thing is when there is for example mm in the name, I want the whole name to be uppercase except the mm part so this won’t do that. It will just make all the sheet names that dont contain the abbreviations upper case and leave the rest

What do you mean it took a long time?

Longer than you doing it manually? Or longer than you would like?

Did you optimize your script to only a few codeblocks?

1 Like