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

Saif Asif edited comment on LANG-1155 at 8/11/15 12:27 PM:
-----------------------------------------------------------

Hi [~britter],

Did you get a chance to look into this? I also made some unit tests for my 
newly added function. 

Possible use cases :-

1. We need to extract out certain phrases (that are quoted or are wrapped in 
some characters) from our file parsers that don't always work on regex. So 
instead of writing a method to skip these characters, we can simply unwrap from 
StringUtils.

2. Parsing a CSV file manually without using regex often results in quoted 
fields. Instead of wiring in the logic to skip wrapping characters in the 
parser itself, we can only focus on the parsing and then rely on 
StringUtils.unwrap to take care of the unwrapping for us.



was (Author: saifasif):
Hi [~britter],

Did you get a chance to look into this? I also made some unit tests for my 
newly added function. 

> New method for StringUtils - unwrap a string token
> --------------------------------------------------
>
>                 Key: LANG-1155
>                 URL: https://issues.apache.org/jira/browse/LANG-1155
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>    Affects Versions: 3.4
>            Reporter: Saif Asif
>              Labels: StringUtil, commons-lang,
>             Fix For: Discussion
>
>
> Proposal to add a new method namely *unwrap* to StringUtils. 
> The method will be responsible for unwrapping a string token from a character 
> (or another string token). Basically, It will be the opposite of the 
> StringUtils.wrap() method.
> Possible outcomes of the method
> {code:title=StringUtils.java|borderStyle=solid}
>      StringUtils.unwrap("\'abc\'", "\'")    = "abc"
>      StringUtils.unwrap("\"abc\"", "\"")    = "abc"
>      StringUtils.unwrap("AABabcBAA", "AA")  = "BabcB"
> {code}



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

Reply via email to