| Author |
MessageFormat Help ?
|
hasan khan
Ranch Hand
Joined: Aug 04, 2003
Posts: 222
|
|
I am reading a String from a file which look like this 12^45^67^45^34^56^43^32^297^O^36^35^35^35^35^1^50^26 the length of the string is not fix. i want to read the first three number ignoring the rest. import java.text.*; public class messageformat { public static void main(String[] args) throws ParseException { MessageFormat mf = new MessageFormat("{0}^{1}^{2}"); String message = "12^45^67^45^34^56^43^32^297^O^36^35^35^35^35^1^50^26"; Object obj[] = mf.parse(message); for(int i=0; i<obj.length; i++) { System.out.println(obj[i]); } } } The output is 12 45 67^45^34^56^43^32^297^O^36^35^35^35^35^1^50^26 but i only want 1st three numbers i.e 12, 45, 67 how to i do ? i am also looking for some good examples of how to use MessageFormat ? please help ...
|
 |
 |
|
|
subject: MessageFormat Help ?
|
|
|