需要做的理由对于给定的字符串与所述给定长度,对齐字符串红宝石
ss = "There is an example to make Justify the text us"
Total length = 50
需要的输出:
ss = "There is an example to make Justify the text us"
这里串的长度与50字符调节之后加入间距第一个字符“There”,最后一个字符“us”,“text”。
都试过了,
qw = ""
string.split(" ").each_with_index do |x,i|
qw = qw + " " + x
end
,但不能能够增加空间
这是非常不清楚你问我害怕。这些空间的目的是什么?它们应该放置在什么地方? – Iceman
我需要在红宝石中对整个段落进行论证(每行50个字符),我做了50或50个字符以上的分割,并且没有打破文字。现在我需要添加行距小于50个字符的行。 –