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

how to display value in a new line using apex class

how can i display a string value in a new line ?
In Apex class i am retrieving Description field and assigning that value to a string of Invoice object. now i am concatenating some value to that String value and assigning to the description field.
Now in the Invoice Screen, i want to display that Concatenated string value in a new line.
i.e. description = old value  
                            Concatenated value
so how can i display in a new line using apex class.
Use the new line code \n or \n\n if you want a blank line in between.

String description = 'old value';
String Concat = 'new value';

description = description +'\n'+Concat;



I tried using '\n' but it doesnt work


errorMessage = 'web service is not returning data at this point of time. Please try again later.';
errorMessage = errorMessage + '\n'+'In case it is urgent, please call the administrator and give them the following error description';
errorMessage = errorMessage + '\n'+e.getMessage();




Please let me know if i am doing something wrong here.






I would try using the '\n\n' instead.

Where do you display this errorMessage value?


\n\n didnt work.


I display this message in an outputText field in visual force