I want to remove all sorts of extra spaces between sentences and get it as one string for some processing
Eg:
The meaning of the phrase "ice cream" varies from one country to another. Phrases
such as "frozen custard", "frozen yogurt", "sorbet", "gelato" and others are used
to distinguish different varieties and styles.
In some countries, such as the United States, the phrase "ice cream" applies only
to a specific variety, and most governments regulate the commercial use of
the various terms according to the relative quantities of the main ingredients.
Products that do not meet the criteria to be called ice cream are labelled
"frozen dairy dessert" instead. In other countries, such as Italy and
Argentina, one word is used for all variants.Analogues made from dairy
alternatives, such as goat's or sheep's milk, or milk substitutes, are
available for those who are lactose intolerant, allergic to dairy protein,
or vegan. The most popular flavours of ice cream in North America (based
on consumer surveys) are vanilla and chocolate.
If I copy the above string in console then it takes only the first sentence then then evaluates it. I want to get this entire paragraph as a string . Is that possible and I tried a lot in this but it removes only white spaces inside a sentence. So it does not make any sense if we remove spaces between words. I want to remove spaces between sentences and paragraphs . Can anyone help me?