Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BEFF917959 for ; Mon, 27 Apr 2015 19:47:44 +0000 (UTC) Received: (qmail 8248 invoked by uid 500); 27 Apr 2015 19:47:39 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 8145 invoked by uid 500); 27 Apr 2015 19:47:39 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 8132 invoked by uid 99); 27 Apr 2015 19:47:39 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Apr 2015 19:47:39 +0000 Date: Mon, 27 Apr 2015 19:47:39 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LANG-1014) Adding unwrap and unwrapFull methods to StringUtils MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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 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)