From 7a196de2289469b24521ea75b74df9284c0c2d36 Mon Sep 17 00:00:00 2001 From: ray Date: Fri, 24 Oct 2003 01:17:51 +0000 Subject: [PATCH] Added fill(), a method to make a string of some character repeated. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1276 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../src/java/com/samskivert/util/StringUtil.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/projects/samskivert/src/java/com/samskivert/util/StringUtil.java b/projects/samskivert/src/java/com/samskivert/util/StringUtil.java index 922af657..084ea388 100644 --- a/projects/samskivert/src/java/com/samskivert/util/StringUtil.java +++ b/projects/samskivert/src/java/com/samskivert/util/StringUtil.java @@ -1,5 +1,5 @@ // -// $Id: StringUtil.java,v 1.59 2003/10/23 16:09:34 eric Exp $ +// $Id: StringUtil.java,v 1.60 2003/10/24 01:17:51 ray Exp $ // // samskivert library - useful routines for java programs // Copyright (C) 2001 Michael Bayne @@ -138,10 +138,19 @@ public class StringUtil * Returns a string containing the requested number of spaces. */ public static String spaces (int count) + { + return fill(' ', count); + } + + /** + * Returns a string containing the specified character repeated the + * specified number of times. + */ + public static String fill (char c, int count) { StringBuffer buf = new StringBuffer(); for (int ii = 0; ii < count; ii++) { - buf.append(" "); + buf.append(c); } return buf.toString(); }