How can I de-duplicate repeated characters in a Java string? -



How can I de-duplicate repeated characters in a Java string? -

does there exist method in java lets transform string how________are_______you how_are_you, i.e. maintain 1 _ when duplicated.

use regexp replacer:

string.replaceall("_+", "_"))

java string

Comments

Popular posts from this blog

javascript - mongodb won't find my schema method in nested container -

Hibernate criteria by a list of natural ids -

ios - Lagging ScrollView with UIWebview inside -