【发布时间】:2014-06-14 23:09:42
【问题描述】:
我想删除句子之间的各种多余空格,并将其作为一个字符串进行一些处理
例如:
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.
如果我在控制台中复制上面的字符串,那么它只需要第一句话然后评估它。我想把这整个段落作为一个字符串。这可能吗,我在这方面做了很多尝试,但它只删除了句子中的空格。因此,如果我们删除单词之间的空格是没有任何意义的。我想删除句子和段落之间的空格 .谁能帮帮我?
【问题讨论】:
-
"[...] 我在这个 [...] 中尝试了很多次" 究竟是什么?告诉我们。