Sometimes in Strings I see something like this %1$s or this %2$d. Can somebody explain to me how to read such things?
Sometimes in Strings I see something like this %1$s or this %2$d . Can
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Check this document http://download.oracle.com/javase/1,5.0/docs/api/java/util/Formatter.html#syntax the string is basically broken in
From your example %1$s,
%means replace with a parameter1$is the position in the parameter array.ssignals that the parameter is a string.This is taken from Java, but a lot of programming languages use the same syntax for string formatting.