You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "James Carman (JIRA)" <ji...@apache.org> on 2010/08/06 03:02:15 UTC
[jira] Issue Comment Edited: (LANG-640) Add normalizeSpace to
StringUtils
[ 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.