<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: times new roman,new york,times,serif; font-size: 12pt; color: #000000'>Mike suggested I try using regular expressions. This works by prepending my number with seven 0s, then using a regular expression to get the last 8 numbers.<div><br></div><div><div>string longname = @strcat("0000000", i);</div><div>string filename = @strcut(longname, "([0-9]........$)");</div><div><br></div><div>I tried to [0-9]{8}$, but it got confused parsing and thought I was trying to reference a variable called 8, so I had to use the dots.</div><br><hr id="zwchr"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"David Kelly" <davidk@ci.uchicago.edu><br><b>To: </b>"swift user" <swift-user@ci.uchicago.edu><br><b>Sent: </b>Friday, June 28, 2013 1:55:53 PM<br><b>Subject: </b>[Swift-user] Mapper padding<br><br><style>p { margin: 0; }</style><div style="font-family: times new roman,new york,times,serif; font-size: 12pt; color: #000000"><font face="times new roman, new york, times, serif" size="3">Hello,</font><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><br></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;">I'm writing a swift script where I'm trying to use the value of an integer to find and map a file. <span style="font-size: 12pt;">The filename I'm trying to map has the number in it, but is always padded with 0s to make it exactly 9 numbers long. The filename for 64 would be 000000064.csv, for example. My number can be any value from 0 to 999999999.</span></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><br></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><span style="font-size: 12pt;">Is there a way to easily build the filename string using any of the existing string libraries? As far as I know we don't have a printf-like way to format this at the moment.</span></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><span style="font-size: 12pt;"><br></span></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><span style="font-size: 12pt;">Is there a way to do this with mapper padding?</span></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><span style="font-size: 12pt;"><br></span></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><span style="font-size: 12pt;">I can do it with an ext mapper, just wondering if there's a better way.</span></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><span style="font-size: 12pt;"><br></span></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><span style="font-size: 12pt;">Thanks,</span></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><span style="font-size: 12pt;">David</span></div><div style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><br></div></div><br>_______________________________________________<br>Swift-user mailing list<br>Swift-user@ci.uchicago.edu<br>https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user</blockquote><br></div></div></body></html>