function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
UrvikUrvik 

Abbreviate Long Text Area and display with ellipses

I have a field with data type long text area. I am displaying it on visualforce page. But I want to allow that field to display only first 200 characters and end it with ellipses (.....). Someone please help.
Gajanan D BhadGajanan D Bhad
Hi Rick,

  You are using standard controller or extension or custom controller. 

 If you are using extension or custom controller then please use following solution.

  I am taking Contact as example and consider, I have custom field discription__c on it. then use following code.

Contact con = [Select Id, description__c  from Contact Limit 1];
 if(con.description__c.lenght() > 200){
    con.description__c = con.subString(0,200)+'(...)';
 }

Thanks,
Gajanan