java - how can i reduce the number of whitespaces in a sentence to 1 if there are more then 1 whitespaces in the sentence? -


How do I reduce the number of white space 1 in a sentence if the sentence has more than 1 more white space? ?

Assuming that "continuous" white space, here's a solution.

  string string = "Hi there are some white spaces here."; String newString = sentence. Riley All ("\\ s +", ""); Println (newString);   

Output:

  Hello there are some white spots here.    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

c# - Confused over DLL entry points (entry point not found exception) -