2009/5/27 Ruby One <[email protected]> > > Julian Leviston wrote: > > On 27/05/2009, at 9:53 PM, Ruby One wrote: > >> games. Our games build skills in math, logic, memory, vocabulary, > >> alphabet, spelling, geography, computer skills, color identification, > >> shape identification and other various problem solving. Our commitment > >> to parents, teachers, and kids, is to connect earning and skill > >> building with a sense of challenge, fun, and self esteem." > >> > >> words = words.gsub(/(.{1,#{line_length}})(\s+|\Z)/, "<=\\1\n") > >> words = words.sub('<=', '') > >> abort words > >> > > > > Hi. > > > > Is it really too much work for you to work out what you need to do? > > > > > > class String > > def word_wrap(line_length=80) > > self.gsub(/(.{1,#{line_length}})(\s+|\Z)/, "<=\\1=>\n") > > end > > end > > > > Perhaps you should join http://sensei.zenunit.com/ > > > > Julian. > > > > ---------------------------------------------- > > Learn: http://sensei.zenunit.com/ > > Last updated 20-May-09 (Rails, Basic Unix) > > Blog: http://random8.zenunit.com/ > > Twitter: http://twitter.com/random8r > > > Great it worked for me !! > > is there any solution to traverse a string character by charcater in > ruby on rails. >
Have you tried looking through the documentation for the String class? See http://www.ruby-doc.org/core/classes/String.html Colin > > Regards > > amit > -- > 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 -~----------~----~----~----~------~----~------~--~---

