You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Barrie Treloar (JIRA)" <ji...@apache.org> on 2010/08/06 02:47:16 UTC
[jira] Created: (LANG-640) Add normalizeSpace to StringUtils
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
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.
[jira] Resolved: (LANG-640) Add normalizeSpace to StringUtils
Posted by "James Carman (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-640?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
James Carman resolved LANG-640.
-------------------------------
Resolution: Fixed
Patch applied (and simplified a bit).
> 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
> Assignee: James Carman
> 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.
[jira] Updated: (LANG-640) Add normalizeSpace to StringUtils
Posted by "Barrie Treloar (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-640?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Barrie Treloar updated LANG-640:
--------------------------------
Attachment: LANG-640-patch.txt
Patch with unit tests included.
> 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: 0.02h
> Remaining Estimate: 0.02h
>
> 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.
[jira] Updated: (LANG-640) Add normalizeSpace to StringUtils
Posted by "Barrie Treloar (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-640?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Barrie Treloar updated LANG-640:
--------------------------------
Original Estimate: 24h (was: 0.02h)
Remaining Estimate: 24h (was: 0.02h)
> 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.
[jira] Issue Comment Edited: (LANG-640) Add normalizeSpace to
StringUtils
Posted by "James Carman (JIRA)" <ji...@apache.org>.
[ 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.
[jira] Commented: (LANG-640) Add normalizeSpace to StringUtils
Posted by "Barrie Treloar (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12895911#action_12895911 ]
Barrie Treloar commented on LANG-640:
-------------------------------------
Thanks,
Why? Mainly because I code verbosely.
But happy to see an alternative way, yours is defintely more readable.
> 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
> Assignee: James Carman
> 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.
[jira] Commented: (LANG-640) Add normalizeSpace to StringUtils
Posted by "James Carman (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12895901#action_12895901 ]
James Carman commented on LANG-640:
-----------------------------------
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.