You parse every time you break down a string in its constituents (numbers, dates etc).
You format every time you use a string template to forge numbers, dates etc.
So, basically, parsing and formatting have to do with conversions from and to strings.
Let's see how this works in Java:
/* * Parsing */ String s = "12.8"; // Returning a primitive wrapper with unboxing float fl = Float.valueOf(s); System.out.println(fl); // Returning a primitive fl = Float.parseFloat(s); System.out.println(fl); /* * Formatting */ float f = 11.4f; // Passing a primitive with boxing s = String.valueOf(f); System.out.println(s); // Passing a primive s = Float.toString(f); System.out.println(s);
Copyright © 2013 Welcome to the website of Davis Fiore. All Rights Reserved.