+ Start a Discussion
Admin User 5120Admin User 5120 

| in System.debug changes to |

Hi,

I'm trying to execute a piece of apex code in workbench and 
system.debug('a || b');

is printing
a || b instead of a || b

Any idea how to retain |.

I tried escaping but escaping | with backslash \| is not permitted.

Background: I'm trying tooling api to create a VF page at runtime. My VF page has a logical OR condition and I was hoping to use a cleaner OR conditions instead of negatory AND conditions.
Best Answer chosen by Admin User 5120
JeffreyStevensJeffreyStevens
Looks like others have had the same issue....

https://developer.salesforce.com/forums/?id=906F000000092TVIAY

All Answers

JeffreyStevensJeffreyStevens
Have you tried?

string pipe = '|';
system.debug('a ' + pipe + pipe + ' b');
Admin User 5120Admin User 5120
@JefferyStevens
I've already tried using a variable and it doesn't work.

I've also tried using join and replace methods and I still end up with | instead of |.
JeffreyStevensJeffreyStevens
Looks like others have had the same issue....

https://developer.salesforce.com/forums/?id=906F000000092TVIAY
This was selected as the best answer