[
https://issues.apache.org/jira/browse/LANG-666?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Vincent Fumo updated LANG-666:
------------------------------
Attachment: StringUtilsTest.java
sample code
> StringUtils.stripEnd() using a '.' as an "any" character
> --------------------------------------------------------
>
> Key: LANG-666
> URL: https://issues.apache.org/jira/browse/LANG-666
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.*
> Affects Versions: 2.5
> Environment: JAVA 6, mac os X
> Reporter: Vincent Fumo
> Priority: Minor
> Attachments: StringUtilsTest.java
>
>
> The documentation for stripEnd() indicates that the second parameter should
> be the string to stip from the end of the first paramater. This mostly works,
> but I think I found a case where it doesn't and that's when there is a period
> '.' character in the stripChars. It seems to be counting the period as a
> regex anychar. Example code :
> // trying to strip the cents from a dollar amount
> String result = StringUtils.stripEnd("120.00", ".00");
> System.out.println("Expected \"120\", got \"" + result + "\"");
>
> // maybe we should escape the dot?
> result = StringUtils.stripEnd("120.00", "\\.00");
> System.out.println("Expected \"120\", got \"" + result + "\"");
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.