Mercurial > dive4elements > framework
diff artifact-database/src/main/java/de/intevation/artifactdatabase/StringUtils.java @ 231:1ea35226a6de
Database cleaner: Ignoring locked artifacts is now done on database level.
artifacts/trunk@1635 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 31 Mar 2011 15:56:50 +0000 |
parents | 933bbc9fc11f |
children | 23ec48ce717e |
line wrap: on
line diff
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/StringUtils.java Thu Mar 31 14:48:28 2011 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/StringUtils.java Thu Mar 31 15:56:50 2011 +0000 @@ -81,5 +81,27 @@ return null; } } + + public static final String repeat(String s, int count, String sep) { + if (count <= 0) { + return ""; + } + StringBuilder sb = new StringBuilder(s); + for (--count; count >= 0; --count) { + sb.append(sep).append(s); + } + return sb.toString(); + } + + public static final String repeat(char c, int count, char sep) { + if (count <= 0) { + return ""; + } + StringBuilder sb = new StringBuilder(2*count-1).append(c); + for (--count; count >= 0; --count) { + sb.append(sep).append(c); + } + return sb.toString(); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :