テキストの文字列をパラメータとして受け取るJavaScriptで関数を作成し、\n
段落を形成する文字列に追加してフォーマットしようとしています。
- 各段落の長さは32文字のみです
- 次の段落に行くときは、単語が半分にカットされていないことを確認する必要があります」
文字列の例:
"If we listened to our intellect, we'd never have a love affair. We'd never have a friendship. We'd never go into business, because we'd be cynical. Well, that's nonsense. You've got to jump off cliffs all the time and build your wings on the way down."
フォーマット後は次のようになります。
If we listened to our intellect, \n
we'd never have a love affair. \n
We'd never have a friendship.\n
We'd never go into business, \n
because we'd be cynical. Well, \n
that's nonsense. You've got to \n
jump off cliffs all the time and \n
build your wings on the way down"
私はこの問題にどのように取り組むかわかりません、そして誰もが解決策全体を解決することを期待していません、私はただ出発点が欲しいです、私はスペースと単語を扱う方法と\nをいつ挿入するかについて問題があります文字列。