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
d3developerd3developer 

Visualforce equivalent of Java StringEscapeUtils

I'm escaping Strings for Javascript and curious if there is anything in APEX that mirrors  the org.apache.commons.lang Class StringEscapeUtils in Visualforce.

 

If not I suppose I will write it myself!

 

Best Answer chosen by Admin (Salesforce Developers) 
Force2b_MikeForce2b_Mike

VisualForce has some function for encoding such as HTMLENCODE, JSENCODE, JSINHTMLENCODE, and URLENCODE. There is also the encodingUtil class in Apex.

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_restful_encodingUtil.htm

 

http://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_functions.htm?SearchType=Stem&Highlight=URLFOR

 

Mike 

All Answers

Force2b_MikeForce2b_Mike

VisualForce has some function for encoding such as HTMLENCODE, JSENCODE, JSINHTMLENCODE, and URLENCODE. There is also the encodingUtil class in Apex.

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_restful_encodingUtil.htm

 

http://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_functions.htm?SearchType=Stem&Highlight=URLFOR

 

Mike 

This was selected as the best answer
d3developerd3developer
Seems to do the trick!