-
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!
-
Re: String File names
I think this is what you're looking for.
Code:
String.Format("target{0}d.png", i);
-
Re: String File names
that worked awesome thanks for the help
-
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.