MessageFormat formatToCharacterIterator() method in Java with Example
The formatToCharacterIterator() method of java.text.MessageFormat class is used to format an array of object and insert them into the pattern of message format object.
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
public AttributedCharacterIterator formatToCharacterIterator(Object arguments)
Parameter: This method takes array of object as an parameter over which formatting is going to take place.
Return Value: This method returns attribute character iterator which will describe the formatted value .
Exception: This method throws NullPointerException if argument is null.
Below are the examples to illustrate the formatToCharacterIterator() method:
formatted array : 4, 4.23, 4.235
argument is null Exception thrown : java.lang.NullPointerException: formatToCharacterIterator must be passed non-null object