commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-1119) Add rotate(string, int) method to StringUtils
Date Tue, 28 Apr 2015 15:22:06 GMT

    [ https://issues.apache.org/jira/browse/LANG-1119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14517187#comment-14517187
] 

ASF GitHub Bot commented on LANG-1119:
--------------------------------------

GitHub user rikles opened a pull request:

    https://github.com/apache/commons-lang/pull/71

    LANG-1119: Add StringUtils.rotate(String, int)

    _Close PR #69. Recreated due to rebase on master._
    
    Implementation of a String rotation method

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/rikles/commons-lang fix-LANG-1119

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/commons-lang/pull/71.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #71
    
----
commit c1da015fa649fc1836d726b9a124c6425263d45e
Author: Loic Guibert <lfdummy-apache@yahoo.fr>
Date:   2015-04-26T12:57:21Z

    LANG-1119: Add StringUtils.rotate(String, int)

----


> 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 =&gt; FABCDE)</li>
>  *  <li>If {@code shift < 0}, left circular shift (ex : ABCDEF =&gt; 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}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message