You need to sign in to do that
Don't have an account?
JamesSS
\n isn't working in inside of string
How to use \n in inside of string? I have used.But its not working.Is any one to find the error in my code? My code Vf page : This is your new Page {!Testvariable } Controller: public with sharing class Test { public string Testvariable{get;set;} public Test (){ Testvariable = 'Male\n\nFemale'; } }
Hi,
Try using <apex:outputText value="{!Testvariable}" escape="false"/>
Please mark it as solution and give Kudos if it helps.
If you are using <label> then use <br/> instead of \n.
Please mark as answer and give kudos if it solves your issue.
Please enter the Name" In that input have one error. "Invalid character used in the string" I have used
.It indicates error.That's why i asked how to use \n in String?
I think you can go with this way
I checked and working fine
<apex:page controller="Test" >
<apex:outputlabel value="{!Testvariable}" escape="false" ></apex:outputlabel>
</apex:page>
public with sharing class Test
{
public string Testvariable{get;set;}
public Test (){
Testvariable = 'Male<br/><br/>Female';
}
}
Please mark this answer and give kudos if it help ful and let me know in case still issue.
Please keep in mind that "\n" will have no effect unless you are using a white-space CSS element (e.g. "pre", or any element with a style that preserves line breaks). That said, you do not need to "escape" the output at all; it's simply a matter of treating the white space with the respect it deserves: