Quantcast
Channel: Active questions tagged string-manipulation - Mathematica Stack Exchange
Viewing all articles
Browse latest Browse all 186

Inserting a 0 in Specific Strings

$
0
0

I have a very large network with 1000's of edges. Below is a small sample. The N is my label for Node and the number that follows is a unique identifier. I want to make all the edges on either side of the arrow (->) into a string of 6 characters. If the left side of the arrow has just 5 characters, then I want to all insert a 0 to the right of the N. Likewise, if the right side of the arrow has just 5 characters, then I want to all insert a 0 to the right of the N. If both sides of the arrow already have 6 characters then do nothing to that edge. The set edges2 is the outcome I'm trying to reach from starting with edges1. Any assistance is much appreciated!

edges1 = {N1003 -> N1003, N1003 -> N1099, N1003 -> N12059,   N1003 -> N22007, N1003 -> N1025}edges2 = {N01003 -> N01003, N01003 -> N01099, N01003 -> N12059,   N01003 -> N22007, N01003 -> N01025}

Viewing all articles
Browse latest Browse all 186

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>