What does {0} do in a properties file?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

What does {0} do in a properties file?

Eric Francis
I'm reading through "Extending Thymeleaf in 5 minutes" and as I was looking through the source code, I noticed that there were were '{0}'s in each property file.

What does {0} do?

Thanks,
Eric
Reply | Threaded
Open this post in threaded view
|

Re: What does {0} do in a properties file?

Zemi
Administrator
This is the standard syntax in Java internationalization. It's a variable which will be substituted at runtime.

For example
     Hello, {0}!

could be at runtime
     Hello, Peter!
or
     Hello, Mary!
or
     Hello, Bandit!