Welcome to Working With Rails


Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
how to truncate htmltext
2 Posts
how to truncate htmltext

Apply this regexp first:

str = "This and that and
and the other?" puts str.gsub(/]*>/, "")

Hi I want to truncate html_text Here in may application am saving headlines into databse, for this am using fckeditor.So i can select htmltags for headlines formatting.

In another page am displaying headlines in one div .But div can show only 10 chars.So am truncating text to 10 by using truncate method.but the prblm is in my headlines have htmltags only for 10 chars then there is nothing to display. So i want to truncate only charcters withou consider htmltags,but whiledispalying it should be with htmltags. Can anybody help .How to solve this.

It's very urgent.Any sugestions will be appriciate

Forum Rating: 50
Sign In To Rate Post
2 Posts
Login to add your message