Is there way to get max index parameter for pattern of the MessageFormat object? for example:
"Dear {0}, some text {0} text"-> 1"Dear {0}, some text {1} text"-> 2"{0,choice,0#0 User|1#User|1<{1} Users}"-> 2
Is there way to get max index parameter for pattern of the MessageFormat object? for example:
"Dear {0}, some text {0} text" -> 1"Dear {0}, some text {1} text" -> 2"{0,choice,0#0 User|1#User|1<{1} Users}" -> 2If you used it once you can use:
MessageFormat format = new MessageFormat("Hello {0}, {1}");
// here somewhere you use it
System.out.println(String.format("Get max index -- %d", new HashSet(Arrays.asList(format.getFormats())).size()));
This prints:
Get max index -- 2