|
-
August 13th, 2009, 06:50 PM
#1
String File names
So I have a stack of pictures that I need to read and I've named them target0, target1, target2, etc. but to type each of those into a string like:
textureFilename[0] = "target1.png";
is inconvenient. Is there a way I can make the number in the string an integer value, similar to a printf, so that I can just put this in a loop?
What I mean by a printf is:
printf("target%d.png", i);
is there something I can do like this for entering a string name in?
Thanks!
-
August 13th, 2009, 06:52 PM
#2
Re: String File names
I think this is what you're looking for.
Code:
String.Format("target{0}d.png", i);
-
August 13th, 2009, 06:59 PM
#3
Re: String File names
that worked awesome thanks for the help
-
August 13th, 2009, 07:04 PM
#4
Re: String File names
monalin's suggestion is the way to go, but you could have always just concatenated the string or used a StringBuilder inside of the loop.
Last edited by BigEd781; August 13th, 2009 at 07:11 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|