following is the method which trims the string which passes as an
argument and trims if it's length is greater than collength.
def trimstring(string, collength)
if(string.length>collength)
@str = ""
col = 0
@lines = 0..(string.length/collength)
for @line in @lines
@str += string[col,collength] + "<br>"
col = col+collength
end
return @str
else
return string
end
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---