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
sadik Shaiksadik Shaik 

how to add extra space between two strings in a trigger?

I would like to extra add space between two strings and insert that into a text area field from a trigger. The text should look like
Avalible Date         Quantity 

Please suggest me..
Best Answer chosen by sadik Shaik
sadik Shaiksadik Shaik
Thank you all so much for your response. I am able to achieve this. The field that I was updating is of a field type Text area(long), that's the reason it was not working I changed the field type to Text area(Rich) and used &nbsp for spacing  'Availability Date'+'&nbsp '+'&nbsp '+'Quantity'; It worked.

All Answers

DevADSDevADS
Hey Sadik,

You can concatenate a string with ' ' (1 space). You can add any number of spaces between two strings.

Refer below example -
String firstString = 'Hello';
String secondString = 'World';
String finalString = firstString + ' ' + secondString;
Do post here if you have any further questions.

Happy Coding!
sadik Shaiksadik Shaik
Hi DevADS,

I have tried it, you add any spaces it only shows 1 space between them. Please check from your end..
DevADSDevADS
This should work, see the screenshot below -
User-added image
abhishek singh 497abhishek singh 497
Hello,
Try to use &nbsp in your code.

Hope this will help.

Thanks & Regards,
Abhishek Singh.
sadik Shaiksadik Shaik
Thank you all so much for your response. I am able to achieve this. The field that I was updating is of a field type Text area(long), that's the reason it was not working I changed the field type to Text area(Rich) and used &nbsp for spacing  'Availability Date'+'&nbsp '+'&nbsp '+'Quantity'; It worked.
This was selected as the best answer