1

I'm trying to define a string with the following value

string s = 'Something\Something';

but I got Illegal character sequence '\S' in string literal.

I tried escaping the backlash with another backlash but I ended up with a string that has two backlashes ('Something\\Something') . What am I doing wrong?

0

1 Answer 1

2

You need to use \\ instead \

string s = 'Something\\Something';

system.debug(s);

Output

19:13:22:003 USER_DEBUG [3]|DEBUG|Something\Something

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .