A quick script to show  how we can take a String value and return it in revers.

 

In this example I will take the text value form a Text field called Text1_c 
and display it in revers in a  formula field.
def myString =  Text1_c  
if(myString != null)  
{  
def revers = ;
for(def i =(myString.length()-1);i>=0; i–)  
  {  
   revers +=  myString.charAt(i);  
  }  
 return revers   
}  
else  
{  
return “No Value To Revers” 
}




 
So the code Above will return in the formula field  No Value To Revers if the text 
field has no value and will revers what ever value will be but in the text field 
as below:
 
 

Leave a Reply

Your email address will not be published. Required fields are marked *