added 'percent' to take a float value and turn it into a nice percent string.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1363 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: StringTool.java,v 1.13 2003/11/05 00:07:53 eric Exp $
|
// $Id: StringTool.java,v 1.14 2004/01/05 19:14:04 eric Exp $
|
||||||
//
|
//
|
||||||
// samskivert library - useful routines for java programs
|
// samskivert library - useful routines for java programs
|
||||||
// Copyright (C) 2001 Michael Bayne
|
// Copyright (C) 2001 Michael Bayne
|
||||||
@@ -53,6 +53,15 @@ public class StringTool
|
|||||||
{
|
{
|
||||||
return String.valueOf(value);
|
return String.valueOf(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a float to a nicely formated percent string.
|
||||||
|
*/
|
||||||
|
public String percent (float value)
|
||||||
|
{
|
||||||
|
return StringUtil.format(value * 100.0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds <p> tags between each pair of consecutive newlines.
|
* Adds <p> tags between each pair of consecutive newlines.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user