Callers can add their own prefix.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2644 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
ray.j.greenwell
2009-11-09 20:48:47 +00:00
parent eabe6e3e66
commit dee9bbc5f9
+3 -13
View File
@@ -334,22 +334,12 @@ public class StringUtil
} }
/** /**
* Format the specified int as a String color value, like "0x000000". * Format the specified int as a String color value, like "000000". You might want
* to add a prefix like "#" or "0x", depending on your usage.
*/ */
public static String toColorString (int c) public static String toColorString (int c)
{ {
return toColorString(c, "0x"); return prepad(Integer.toHexString(c), 6, '0');
}
/**
* Format the specified int as a String color value.
*
* @param c the int value to format.
* @param prefix something like "0x" or "#", or just "".
*/
public static String toColorString (int c, String prefix)
{
return prefix + prepad(Integer.toHexString(c), 6, '0');
} }
/** /**