commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Fumo (JIRA)" <j...@apache.org>
Subject [jira] Created: (LANG-666) StringUtils.stripEnd() using a '.' as an "any" character
Date Wed, 08 Dec 2010 18:02:02 GMT
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


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.


Mime
View raw message