apache/commons-lang — pull request #25 by thiagoh (2014-05-14 21:05:10+00:00)
Title: 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