how to read from file raw and use in String.format

Viewed 336

I want to read data from a raw file and replace the format in the text.

For example... In a raw file like this:

hello {0}, my name id {1}, my age is {2}....

When I use String.format, as shown below, the text loses its indentation.

String data = readTextFile(this, R.raw.input);
data = String.format(data, "world", "josh", "3"); 

Does anyone know how to do this without losing indentation?

3 Answers
Related