java - How to count the number of pairs in a string -


if enter string "in win". how go having program finding pairs "in" in string. there two. know find occurrences of 1 character in string, how pair.

thank you.

use countmatches method of apache commons stringutils class (http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/stringutils.html).

stringutils.countmatches("in win", "in"); 

Comments

Popular posts from this blog

css - I want to align grid in center -

Contact Form PHP Email Script -

python - SWIG function not printing output -