Java org.apache.commons.lang CharSetUtils fields, constructors, methods, implement or subclass

Example usage for Java org.apache.commons.lang CharSetUtils fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for org.apache.commons.lang CharSetUtils.

The text is from its open source code.

Subclass

org.apache.commons.lang.CharSetUtils has subclasses.
Click this link to see all its subclasses.

Method

intcount(String str, String set)

Takes an argument in set-syntax, see evaluateSet, and returns the number of characters present in the specified string.

 CharSetUtils.count(null, *)        = 0 CharSetUtils.count("", *)          = 0 CharSetUtils.count(*, null)        = 0 CharSetUtils.count(*, "")          = 0 CharSetUtils.count("hello", "k-p") = 3 CharSetUtils.count("hello", "a-e") = 1 
intcount(String str, String[] set)

Takes an argument in set-syntax, see evaluateSet, and returns the number of characters present in the specified string.

An example would be:

  • count("hello", {"c-f", "o"}) returns 2.
Stringdelete(String str, String set)

Takes an argument in set-syntax, see evaluateSet, and deletes any of characters present in the specified string.

 CharSetUtils.delete(null, *)        = null CharSetUtils.delete("", *)          = "" CharSetUtils.delete(*, null)        =  CharSetUtils.delete(*, "")          =  CharSetUtils.delete("hello", "hl")  = "eo" CharSetUtils.delete("hello", "le")  = "ho" 
Stringdelete(String str, String[] set)

Takes an argument in set-syntax, see evaluateSet, and deletes any of characters present in the specified string.

An example would be:

  • delete("hello", {"c-f", "o"}) returns "hll"
Stringkeep(String str, String set)

Takes an argument in set-syntax, see evaluateSet, and keeps any of characters present in the specified string.

 CharSetUtils.keep(null, *)        = null CharSetUtils.keep("", *)          = "" CharSetUtils.keep(*, null)        = "" CharSetUtils.keep(*, "")          = "" CharSetUtils.keep("hello", "hl")  = "hll" CharSetUtils.keep("hello", "le")  = "ell" 
Stringkeep(String str, String[] set)

Takes an argument in set-syntax, see evaluateSet, and keeps any of characters present in the specified string.

An example would be:

  • keep("hello", {"c-f", "o"}) returns "eo"
Stringsqueeze(String str, 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" 
Stringsqueeze(String str, String[] set)

Squeezes any repetitions of a character that is mentioned in the supplied set.

An example is:

  • squeeze("hello", {"el"}) => "helo"