Replacing list element based on a criteria

Hello,

It’s been a short while working with dynamo, and I’m developing scripts as the need arises. A small part of my script is to convert an alphanumeric sequence to all have two-digit numbers, so that I can sort them. I found the logic for a different process and tried to extrapolate it to my requirement. However, I haven’t had much success. Is there anything I’m not doing right?

Thank you in advance!

You’re welcome

Pad Strings.dyn (3.8 KB)

Just to add another option…


Hope that helps.

Thank you, @truevis and @Jibz_Cello

I guess I need to know more about the nodes that exist! Pad Left is amazing!

@Jibz_Cello, I did not go through the entire script, but your starting list was exactly what I had. There are different alphabets, and the logic of removing the rest of the string to preserve the alphabet was just what I needed. I padded with the required number of zeros and joined them back, and that’s what I wanted to accomplish!

I am however curious why my original logic did not work.
I had it based on this post:


on this thread:
http://dynamobim.org/forums/topic/replacing-items-in-a-list-based-on-search-criteria/

You would have to conect the String.Contains to finc0 and the <= to func1. Something like this.

1 Like

That was just a simple change to constructing the condition, and it worked!!
Thank you so much!

I’m slowly but surely getting around to understanding how to create conditions, keeping the input fields blank.