+ Start a Discussion
DannyK89DannyK89 

Getting a certain length of characters from a Long Text Area Field

I was wonderting if there is a way to get a certain number of characters from a Long Text Area Field. I only want 500 Characters of the Long Text Area Field. 

Best Answer chosen by Admin (Salesforce Developers) 
WizradWizrad

500 random characters?  The first 500?  The last 500?

 

Search the following page for "String" and click the result "String Methods".  Look into the substring method.

 

http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_qs_HelloWorld.htm

All Answers

WizradWizrad

500 random characters?  The first 500?  The last 500?

 

Search the following page for "String" and click the result "String Methods".  Look into the substring method.

 

http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_qs_HelloWorld.htm

This was selected as the best answer
Ankit AroraAnkit Arora

Get the value from text area field in string and do something like this :

 

String textAreaStr = Your_Text_Area_Value ;
textAreaStr = textAreaStr.substring(0 , 499) ;

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page