Trying to remove "\" from a string

R

Robert

Hello.

I have tried to remove the char "\" from a string that I am building in
codebehind.
to be used in a script tag.

I have tried adding (char)34 to the string instead of the escape character,
as well as @then double quotes.
when i watch the string in the command window or the watch window it has the
escape character in the string allways \"
I have tried to use replace.. but you cant replace a escape character, I
tryed establishing a char variable as (char)92

My question is how the heck can I build a string without an escape character
around the quotes ?

Thanks,
Rob
 
G

George

i did not understand your problem but those sample might help you.

Code ---- You see
Response.Write(\\aa\\bb) --- \aa\bb
Response.Write("\"aa") ---- "aa

George
My Site - Body Jewelry
Hello.

I have tried to remove the char "\" from a string that I am building in
codebehind.
to be used in a script tag.

I have tried adding (char)34 to the string instead of the escape character,
as well as @then double quotes.
when i watch the string in the command window or the watch window it has the
escape character in the string allways \"
I have tried to use replace.. but you cant replace a escape character, I
tryed establishing a char variable as (char)92

My question is how the heck can I build a string without an escape character
around the quotes ?

Thanks,
Rob
 
H

Hans Kesting

Hello.

I have tried to remove the char "\" from a string that I am building in
codebehind.
to be used in a script tag.

I have tried adding (char)34 to the string instead of the escape character,
as well as @then double quotes.
when i watch the string in the command window or the watch window it has the
escape character in the string allways \"
I have tried to use replace.. but you cant replace a escape character, I
tryed establishing a char variable as (char)92

My question is how the heck can I build a string without an escape character
around the quotes ?

Thanks,
Rob

Probably you don't need to worry:
the watch and debugger windows just *display* the string with escaped
inner quotes and maybe a "@" in front. Try and set a label to display
the value, you should not see the escape characters then, or
find out the length of the string.

So, if the *real* value is
this is a "test"
the watch window might display
@"this is a \"test\""

Hans Kesting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top