[
https://issues.apache.org/jira/browse/LANG-1119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14517256#comment-14517256
]
ASF GitHub Bot commented on LANG-1119:
--------------------------------------
Github user coveralls commented on the pull request:
https://github.com/apache/commons-lang/pull/71#issuecomment-97113081
[](https://coveralls.io/builds/2441700)
Coverage increased (+0.0%) to 93.83% when pulling
**c1da015fa649fc1836d726b9a124c6425263d45e on rikles:fix-LANG-1119** into
**63d8a025e6f38ddfc966c4104ac783bcb59031e0 on apache:master**.
> Add rotate(string, int) method to StringUtils
> ---------------------------------------------
>
> Key: LANG-1119
> URL: https://issues.apache.org/jira/browse/LANG-1119
> Project: Commons Lang
> Issue Type: New Feature
> Components: lang.*
> Reporter: Loic Guibert
>
> Add a method to rotate (circular shift) a String into StringUtils.
> {code:java}
> /**
> * <p>Rotate (circular shift) a String of {@code shift} characters.</p>
> * <ul>
> * <li>If {@code shift > 0}, right circular shift (ex : ABCDEF =>
> FABCDE)</li>
> * <li>If {@code shift < 0}, left circular shift (ex : ABCDEF =>
> BCDEFA)</li>
> * </ul>
> *
> * <pre>
> * StringUtils.rotate(null, *) = null
> * StringUtils.rotate("", *) = ""
> * StringUtils.rotate("abcdefg", 0) = "abcdefg"
> * StringUtils.rotate("abcdefg", 2) = "fgabcde"
> * StringUtils.rotate("abcdefg", -2) = "cdefgab"
> * StringUtils.rotate("abcdefg", 7) = "abcdefg"
> * StringUtils.rotate("abcdefg", -7) = "abcdefg"
> * StringUtils.rotate("abcdefg", 9) = "fgabcde"
> * StringUtils.rotate("abcdefg", -9) = "cdefgab"
> * </pre>
> *
> * @param str the String to rotate, may be null
> * @param shift number of time to shift (positive : right shift, negative :
> left shift)
> * @return the rotated String,
> * or the original String if {@code shift == 0},
> * or {@code null} if null String input
> */
> public static String rotate(String str, int shift);
> {code}
> See PR #71 : https://github.com/apache/commons-lang/pull/71
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)