[Swift-user] Mapper padding
David Kelly
davidk at ci.uchicago.edu
Fri Jun 28 15:53:01 CDT 2013
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.
string longname = @strcat("0000000", i);
string filename = @strcut(longname, "([0-9]........$)");
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.
----- Original Message -----
> From: "David Kelly" <davidk at ci.uchicago.edu>
> To: "swift user" <swift-user at ci.uchicago.edu>
> Sent: Friday, June 28, 2013 1:55:53 PM
> Subject: [Swift-user] Mapper padding
> Hello,
> I'm writing a swift script where I'm trying to use the value of an
> integer to find and map a file. 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.
> 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.
> Is there a way to do this with mapper padding?
> I can do it with an ext mapper, just wondering if there's a better
> way.
> Thanks,
> David
> _______________________________________________
> Swift-user mailing list
> Swift-user at ci.uchicago.edu
> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-user/attachments/20130628/c359dab5/attachment.html>
More information about the Swift-user
mailing list