commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell (JIRA)" <>
Subject [jira] Commented: (LANG-348) Add StringUtils.repeat with separator
Date Tue, 20 Oct 2009 04:59:59 GMT


Henri Yandell commented on LANG-348:

Given it's likely to be used on small Strings, I'd rather just have an API of:

repeat(String, String, int)

I did testing with join and found that char separates were 10% faster, but there's no pressing
need to add the char overload until requested.

Biggest pain in this - the repeat method is quite an optimized method and you can't simply
splice in a separator. In fact - given the optimization I think the repeat and removeEnd method
will be the best.

> Add StringUtils.repeat with separator
> -------------------------------------
>                 Key: LANG-348
>                 URL:
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Kees van Dieren
>            Priority: Minor
>             Fix For: 3.0
> I would like to have a repeat method with the ability to set a separator:
> public static String repeat(String str, char separatorChar, int repeat)
> Usage scenario: generate insert statements for JDBC preparedstatements:
> assertEquals("?,?,?,?", StringUtils.repeat("?", ',', 4));
> Can this be added to commons-lang?
> Thanks!

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message