2016-03-16 219 views
0

str='My long string with this text'Rails的截斷字符串

我知道,但它減少的話

我的目標是保持完整的單詞截斷後。可能嗎?

字符串可以是任意長度

+4

您可以使用分離選項。 請訪問:http://stackoverflow.com/questions/8714045/truncate-a-string-without-cut-in-the-middle-of-a-word-in-rails – dp7

回答