You need to sign in to do that
Don't have an account?
Terminusbot
Apex String - Add a backslash to a string.
I am trying to insert a \ into a string. In front of the date and the end of the date I need to insert the \. Can this be done?
writer.writeAttribute(null,null,'statement', 'LIST POLICIES LAST.ENTRY.DATE GT \7/26/2016\ *OUTPUT* CLIENT.CODE 31 32 33');
If you want to add a backslash into a string, you will need to add double backslashes. The first one will escape the second one, which will result in a single backslash in your string.
Example:
This will result in:
This is a string with a \ in it
Hope this helps!
Best regards,
Martijn Schwärzer
Ps. If my answer helped you, please mark it as best answer. It will help others find best answer as well.
All Answers
If you want to add a backslash into a string, you will need to add double backslashes. The first one will escape the second one, which will result in a single backslash in your string.
Example:
This will result in:
This is a string with a \ in it
Hope this helps!
Best regards,
Martijn Schwärzer
Ps. If my answer helped you, please mark it as best answer. It will help others find best answer as well.
Your code should be like below
Let us know if this will help you