sabi97
asked on
Replacing apostrophe within a string
Hi,
I'm trying to replace any apostrophes within a string, using :
advert = advert.replace(''', ' ');
but get an 'Unclosed string literal' error.
How do I get around this?
Cheers
sabi97
I'm trying to replace any apostrophes within a string, using :
advert = advert.replace(''', ' ');
but get an 'Unclosed string literal' error.
How do I get around this?
Cheers
sabi97
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The apostrophe is the char delimiter. You need to use the escape sequence \'.
advert = advert.replace('\'',' ');
advert = advert.replace('\'',' ');
Do you get a feeling of deja vu?
ASKER
Many thanks!
this will work.....