Link to home
Start Free TrialLog in
Avatar of mayachoy
mayachoy

asked on

Eliminate single quote

Hi,

batchMsg+=" ' " + batchID +" ' "

When I use <%=batchMsg%> it displays the single quote.
How to don't display the single quote?

Thank you.


ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
grrrrrr, can I get a word in edgewise ;)

checking for null always seems liek a good idea!  ...and el_dios, you've got one too many dots in there for the replaceAll call:

<%=batchMsg==null?"":batchMsg.replaceAll("'", "")%>

...I'm confused that you sound confused by this?  You're adding the single quotes to the string using the concatination operator.  When you add those single quotes like that, they become a part of the string.  Why are you quoting the batchID anyway, if it's for query there are NO quotes around integer values, so the first suggestion may not be so bad, but no need to append an empty string at the end?

batchMsg+="" + batchID;

is batchID an integer variable?
batchMsg=batchMsg+""+ batchID;

will solve your problem don't Complicate the things.
:-)
Avatar of aaaaaa
aaaaaa

<%=batchID%>