View Single Post
  #2 (permalink)  
Old 08-07-2007, 06:10 AM
coco coco is offline
Member
 
Join Date: Jul 2007
Posts: 39
coco is on a distinguished road
Not exactly. It doesn't "return" it at all, it just sends it to the out stream using printf...

If you really needed to format a string you could do so through the string
utilities. For example, substring should be able to cut off the part of the string you want.

String (Java 2 Platform SE v1.4.2)

This means however that you will have to check to see if the string is too short. If you don't you'll get an outofbounds exception. So just check the length, if it's less then what you want to crop it to, just return it, else, crop it with substring and return it.
Greetings.
Reply With Quote