You need to sign in to do that
Don't have an account?
Surender
New line character in APEX
Hi,
I have String array with some values. I want to print those values line by line.
Also let me know how can we use escape characters in APEX.
Please share your suggestions.
Regards
Surender
APEX is simliar to Java (In fact, you can think of it as a wrapper on top of Java) in syntax and language constructs.
For your example, you can use '\n' to insert a linebreak in a string.
ArrayList<String> vals = new ArrayList<String>('A','B','C');
String allStrings = '';
for(String val : vals)
{
allStrings = allStrings + val + '\n' ;
}
You can escape characters with the '\' symbol.
Example:
At the top, add this attribute:
<aura:attribute name="title" type="String" default="Connect, talk shop and swap success stories,<br/> pics and trade secrets with members of the community."/>
In your code, add this to your attribute reference like so:
<aura:unescapedHtml value="{!v.title}" />
\n it's not working in the console.