mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-10 03:55:10 +00:00
Added public static String removeEnd(String str, String remove).
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137699 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
576920fa5b
commit
293c1a7ea6
@ -75,7 +75,7 @@
|
||||
* @author <a href="hps@intermeta.de">Henning P. Schmiedehausen</a>
|
||||
* @author Phil Steitz
|
||||
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
|
||||
* @version $Id: StringUtilsTest.java,v 1.53 2003/10/29 01:50:14 ggregory Exp $
|
||||
* @version $Id: StringUtilsTest.java,v 1.54 2003/10/29 02:16:30 ggregory Exp $
|
||||
*/
|
||||
public class StringUtilsTest extends TestCase {
|
||||
|
||||
@ -277,8 +277,6 @@ public void testConcatenate_Objectarray() {
|
||||
assertEquals("foo2", StringUtils.concatenate(MIXED_TYPE_LIST));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void testSplit_String() {
|
||||
assertEquals(null, StringUtils.split(null));
|
||||
assertEquals(0, StringUtils.split("").length);
|
||||
@ -1003,5 +1001,22 @@ public void testRemoveStart() {
|
||||
assertEquals(StringUtils.removeStart("domain.com", "www."), "domain.com");
|
||||
assertEquals(StringUtils.removeStart("domain.com", ""), "domain.com");
|
||||
}
|
||||
|
||||
public void testRemoveEnd() {
|
||||
// StringUtils.removeEnd("", *) = ""
|
||||
assertNull(StringUtils.removeEnd(null, null));
|
||||
assertNull(StringUtils.removeEnd(null, ""));
|
||||
assertNull(StringUtils.removeEnd(null, "a"));
|
||||
|
||||
// StringUtils.removeEnd(*, null) = *
|
||||
assertEquals(StringUtils.removeEnd("", null), "");
|
||||
assertEquals(StringUtils.removeEnd("", ""), "");
|
||||
assertEquals(StringUtils.removeEnd("", "a"), "");
|
||||
|
||||
// All others:
|
||||
assertEquals(StringUtils.removeEnd("www.domain.com", ".com"), "www.domain");
|
||||
assertEquals(StringUtils.removeEnd("www.domain", ".com"), "www.domain");
|
||||
assertEquals(StringUtils.removeEnd("domain.com", ""), "domain.com");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user