List of usage examples for org.apache.commons.lang3 CharSetUtils squeeze
public static String squeeze(final String str, final String... set)
Squeezes any repetitions of a character that is mentioned in the supplied set.
CharSetUtils.squeeze(null, *) = null CharSetUtils.squeeze("", *) = "" CharSetUtils.squeeze(*, null) = CharSetUtils.squeeze(*, "") = CharSetUtils.squeeze("hello", "k-p") = "helo" CharSetUtils.squeeze("hello", "a-e") = "hello"
From source file:yoyo.framework.standard.shared.commons.lang.CharSetUtilsTest.java
@Test public void test() { assertThat(CharSetUtils.count(null, "a-z"), is(0)); assertThat(CharSetUtils.count("", "a-z"), is(0)); assertThat(CharSetUtils.count("hello", "k-p"), is(3)); assertThat(CharSetUtils.count("hello", "a-e"), is(1)); assertThat(CharSetUtils.count("hello", "a", "b", "c", "d", "e"), is(1)); assertThat(CharSetUtils.delete(null, "a-z"), is(nullValue())); assertThat(CharSetUtils.delete("", "a-z"), is("")); assertThat(CharSetUtils.delete("hello", "hl"), is("eo")); assertThat(CharSetUtils.keep(null, "a-z"), is(nullValue())); assertThat(CharSetUtils.keep("", "a-z"), is("")); assertThat(CharSetUtils.keep("hello", "hl"), is("hll")); assertThat(CharSetUtils.squeeze(null, "a-z"), is(nullValue())); assertThat(CharSetUtils.squeeze("", "a-z"), is("")); assertThat(CharSetUtils.squeeze("hello", "k-p"), is("helo")); }