+ Start a Discussion
soasoa 

How to concat special character to a string..

Hi ,
 
I am trying to Concat strings using Apex.
While concatinating a string with Special character '&' .. it is not taking '&'..
 
For eg..
String concat = ('http://webservices.amazon.com/onca/xml?Service=AWSECommerceService' + '&');
 
How do I cancat an & to a string..
Please help..
 
Regards
Diti
hisrinuhisrinu
Have u tried this way?

String s = 'abc'+'\&';

JimRaeJimRae
Why do you think that it isn't working?  I tried a simple test in my system log


Code:
String concat = ('http://webservices.amazon.com/onca/xml—Service=AWSECommerceService' + '&');
system.debug(concat);

And the ampersand appears at the end of the string.  Are you doing something else to the string after this?