[jira] [Commented] (LANG-890) Adding equalsIgnoreWhiteSpaces() method to StringUtils

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] [Commented] (LANG-890) Adding equalsIgnoreWhiteSpaces() method to StringUtils

Phil Steitz (Jira)

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

Sebb commented on LANG-890:

bq. Please advise on how i can share the code for this new method.

Not exactly sure what you mean by that, but patches (unified diff) are accepted as attachments.

However, it might make more sense to provide a method to collapse all whitespace to a single space (should probably also trim leading/trailing whitespace). Do that to both strings and then compare them.

I think that would be more generally useful than an equals method, as it would allow both case-sensitive and insensitive natching as well as potentially detecting the first difference etc.

There could also be a method to remove all whitespace.
That would ignore word-boundaries in comparisons, but would have other uses.

> Adding equalsIgnoreWhiteSpaces() method to StringUtils
> ------------------------------------------------------
>                 Key: LANG-890
>                 URL: https://issues.apache.org/jira/browse/LANG-890
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>    Affects Versions: 4.0
>         Environment: New Feature
>            Reporter: Thilak
>              Labels: StringUtil
>             Fix For: 4.0
>   Original Estimate: 0h
>  Remaining Estimate: 0h
> Currently, no java uitility package offers a method to compare two strings which differ only in format & white spaces for equality. The common scenario when we need such a method would be (a) when one needs to perform equality check between two narrative fields in a SWIFT message or (b) to compare a paragrapgh retreived from different files.
> Please advise on how i can share the code for this new method. thank you

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira