commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Carman (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (LANG-640) Add normalizeSpace to StringUtils
Date Fri, 06 Aug 2010 01:02:15 GMT

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

James Carman edited comment on LANG-640 at 8/5/10 9:02 PM:
-----------------------------------------------------------

Why not just do this:

private static final Pattern WHITESPACE_BLOCK = Pattern.compile("\\s+");

public static String normalizeWhite(String input)
{
    if(input == null)
    {
        return input;
    }
    return WHITESPACE_BLOCK.matcher(input.trim()).replaceAll(" ");
}

      was (Author: jwcarman):
    Why not use String.replaceAll("\\s+", " ")?
  
> Add normalizeSpace to StringUtils
> ---------------------------------
>
>                 Key: LANG-640
>                 URL: https://issues.apache.org/jira/browse/LANG-640
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>    Affects Versions: 3.0
>            Reporter: Barrie Treloar
>             Fix For: 3.0
>
>         Attachments: LANG-640-patch.txt
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> StringUtils lacks normalizeSpace similar to http://www.w3.org/TR/xpath/#function-normalize-space

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message