我需要拆分字符串並從底部開始在我的視圖中打印它。標準方式從頭開始讀取字符串並進行相應打印。我如何扭轉它?Ruby-rails - 拆分字符串並按相反順序打印
<% @a[:log].to_s.split(/----/).each do |line| %>
<div width='100%'><pre class="log"><%= "#{line}" %></pre></div>
<% end %>
@a[:log] is a string something like this: One ---- Two ---- Three ---- Four
I want this printed reverse starting from Four, instead of One.
<div width='100%'><pre class="log">Four</pre></div>
<div width='100%'><pre class="log">Three</pre></div>
<div width='100%'><pre class="log">Two</pre></div>
<div width='100%'><pre class="log">One</pre></div>
哇。不知道那很容易。謝謝! – 2012-04-14 14:12:52
不客氣! – Mischa 2012-04-14 14:24:44