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-1014) Adding unwrap and unwrapFull methods to StringUtils
Date Mon, 27 Apr 2015 19:47:39 GMT

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

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

GitHub user thiagoh reopened a pull request:

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

    Adding unwrap and unwrapFull methods to StringUtils

    Adding the following methods from `StringUtils`:
    * `public static String unwrap(String str, char unwrapChar)`
    * `public static String unwrapFull(String str, char unwrapChar)`
    * `public static String unwrap(String str, String unwrapStr)`
    * `public static String unwrapFull(String str, String unwrapStr)`
    * `public static String unwrap(String str, String unwrapLeft, String unwrapRight)`
    * `public static String unwrapFull(String str, String unwrapLeft, String unwrapRight)`
    
    These methods unwraps (fully or not) the string parameter
    
    Usage:
    ```
    
    // public static String unwrap(String str, char unwrapChar)
    StringUtils.unwrap("", '\0') = ""
    StringUtils.unwrap("xabx", 'x') = "ab"
    StringUtils.unwrap("\"ab\"", '\"') = "ab"
    StringUtils.unwrap("\"\"ab\"\"", '\"') = "\"ab\""
    StringUtils.unwrap("'ab'", '\'') = "ab"
    StringUtils.unwrap("''ab''", '\'') = "'ab'"
    StringUtils.unwrap("'''ab'''", '\'') = "''ab''"
    StringUtils.unwrap("'\"abcd\"'", '\'') = "\"abcd\""
    StringUtils.unwrap("'\"abcd\"'", '\"') = "'\"abcd\"'"
    
    // public static String unwrapFull(String str, char unwrapChar)
    StringUtils.unwrapFull("", '\0') = ""
    StringUtils.unwrapFull("xabx", 'x') = "ab"
    StringUtils.unwrapFull("xxxxxxabxxxxxx", 'x') = "ab"
    StringUtils.unwrapFull("\"ab\"", '\"') = "ab"
    StringUtils.unwrapFull("\"\"ab\"\"", '\"') = "ab"
    StringUtils.unwrapFull("'ab'", '\'') = "ab"
    StringUtils.unwrapFull("'x'ab'x'", '\'') = "x'ab'x"
    StringUtils.unwrapFull("''ab''", '\'') = "ab"
    StringUtils.unwrapFull("'''''ab'''''", '\'') = "ab"
    StringUtils.unwrapFull("''''x'ab'''''", '\'') = "x'ab'"
    StringUtils.unwrapFull("'ab''''", '\'') = "ab'''"
    
    // public static String unwrap(String str, String unwrapStr)
    StringUtils.unwrap("xxabxx", "xx") = "ab"
    StringUtils.unwrap("xxxxabxxxx", "xx") = "xxabxx"
    StringUtils.unwrap("xx xxabxx xx", "xx") = " xxabxx "
    StringUtils.unwrap("xxZxx", "xx") = "Z"
    StringUtils.unwrap("xxZxx", "x") = "xZx"
    StringUtils.unwrap("xzx xzx", "xzx") = " "
    StringUtils.unwrap("xxxx xxxx", "xx") = "xx xx"
    StringUtils.unwrap("'name'", "'") = "name"
    StringUtils.unwrap("''name''", "'") = "'name'"
    StringUtils.unwrap("'''name'''", "'") = "''name''"
    
    // public static String unwrapFull(String str, String unwrapStr)
    StringUtils.unwrapFull("xxabxx", "x") = "ab"
    StringUtils.unwrapFull("xx xxabxx xx", "xx") = " ab "
    StringUtils.unwrapFull("xxZxx", "xx") = "Z"
    StringUtils.unwrapFull("xzx xzx", "xzx") = " "
    StringUtils.unwrapFull("xxxx xxxx", "xx") = " "
    StringUtils.unwrapFull("'name'", "'") = "name"
    StringUtils.unwrapFull("''name''", "'") = "name"
    StringUtils.unwrapFull("'''name'''", "'") = "name"
    
    // public static String unwrap(String str, String unwrapLeft, String unwrapRight)
    StringUtils.unwrap("xxabxx", "x", "x") = "ab"
    StringUtils.unwrap("xx xxabxx xx", "xx", "xx") = " ab "
    StringUtils.unwrap("xxZxx", "xx", "xx") = "Z"
    StringUtils.unwrap("xxZxx", "xx", "yy") = "xxZxx" // no unwrap
    StringUtils.unwrap("xzx xzx", "xzx", "xzx") = " "
    StringUtils.unwrap("xxxx xxxx", "xx", "xx") = " "
    StringUtils.unwrap("xxxx xxxx", "xx", "yy") = "xxxx xxxx" // no unwrap
    StringUtils.unwrap("xxxxxxxxxxoutputxxxxxxxxxx", "xxxxx", "xxxxx") = "output"
    StringUtils.unwrap("%{name}", "%{", "}") = "name"
    StringUtils.unwrap("%{ name}", "%{", "}") = " name"
    StringUtils.unwrap("%{ name }", "%{", "}") = " name "
    StringUtils.unwrap(" %{ name }", "%{", "}") = "  name "
    StringUtils.unwrap("%{'name'}", "%{'", "'}") = "name"
    StringUtils.unwrap("%{' name'}", "%{'", "'}") = " name"
    StringUtils.unwrap("%{' name '}", "%{'", "'}") = " name "
    StringUtils.unwrap(" %{' name '}", "%{'", "'}") = "  name "
    StringUtils.unwrap("%{ 'name'}", "%{'", "'}") = "%{ 'name'}" // no unwrap
    StringUtils.unwrap("% {'name'}", "%{'", "'}") = "% {'name'}" // no unwrap
    StringUtils.unwrap("% { 'name'}", "%{'", "'}") = "% { 'name'}" // no unwrap
    
    // public static String unwrapFull(String str, String unwrapLeft, String unwrapRight)
    StringUtils.unwrapFull("xxabxx", "x", "x") = "ab"
    StringUtils.unwrapFull("xx xxabxx xx", "xx", "xx") = " ab "
    StringUtils.unwrapFull("xxZxx", "xx", "xx") = "Z"
    StringUtils.unwrapFull("xxZxx", "xx", "yy") = "xxZxx" // no unwrap
    StringUtils.unwrapFull("xzx xzx", "xzx", "xzx") = " "
    StringUtils.unwrapFull("xxxx xxxx", "xx", "xx") = " "
    StringUtils.unwrapFull("xxxx xxxx", "xx", "yy") = "xxxx xxxx" // no unwrap
    StringUtils.unwrapFull("xxxxxxxxxxoutputxxxxxxxxxx", "xxxxx", "xxxxx") = "output"
    StringUtils.unwrapFull("%{name}", "%{", "}") = "name"
    StringUtils.unwrapFull("%{ name}", "%{", "}") = " name"
    StringUtils.unwrapFull("%{ name }", "%{", "}") = " name "
    StringUtils.unwrapFull(" %{ name }", "%{", "}") = "  name "
    StringUtils.unwrapFull("%{'name'}", "%{'", "'}") = "name"
    StringUtils.unwrapFull("%{' name'}", "%{'", "'}") = " name"
    StringUtils.unwrapFull("%{' name '}", "%{'", "'}") = " name "
    StringUtils.unwrapFull(" %{' name '}", "%{'", "'}") = "  name "
    StringUtils.unwrapFull("%{ 'name'}", "%{'", "'}") = "%{ 'name'}" // no unwrap
    StringUtils.unwrapFull("% {'name'}", "%{'", "'}") = "% {'name'}" // no unwrap
    StringUtils.unwrapFull("% { 'name'}", "%{'", "'}") = "% { 'name'}" // no unwrap
    
    ```
    
    Jira ticket https://issues.apache.org/jira/browse/LANG-1014

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

    $ git pull https://github.com/thiagoh/commons-lang branch-2-unwrap

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

    https://github.com/apache/commons-lang/pull/25.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 #25
    
----
commit 97261aa164cb0d924188dbcb5634afc2935305b3
Author: thiagoh <thiagoh@gmail.com>
Date:   2014-05-14T20:55:52Z

    Adding unwrap and unwrapFull methods to StringUtils

----


> Adding unwrap and unwrapFull methods to StringUtils
> ---------------------------------------------------
>
>                 Key: LANG-1014
>                 URL: https://issues.apache.org/jira/browse/LANG-1014
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>            Reporter: Thiago Andrade
>            Assignee: Benedikt Ritter
>              Labels: github
>             Fix For: Review Patch
>
>
> Placeholder ticket for github PR 25: https://github.com/apache/commons-lang/pull/25
> Adding the following methods from StringUtils:
> {code:java}
>     public static String unwrap(String str, char unwrapChar)
>     public static String unwrapFull(String str, char unwrapChar)
>     public static String unwrap(String str, String unwrapStr)
>     public static String unwrapFull(String str, String unwrapStr)
>     public static String unwrap(String str, String unwrapLeft, String unwrapRight)
>     public static String unwrapFull(String str, String unwrapLeft, String unwrapRight)
> {code}
> These methods unwraps (fully or not) the string parameter. See pull request for usage
examples.



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

Mime
View raw message