Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
C# replace command
Message
From
16/01/2008 10:21:24
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01282218
Message ID:
01282225
Views:
7
>Hi everybody,
>
>Ok, this is what I expected, but why it doesn't work and how can I make a replace?
>
>"I'm a girl"
>Server.UrlEncode(strPageTitle).Replace("'","\'")
>"I'm+a+girl"
>
>I need to replace ' with a \' and the Replace doesn't work perhaps from the overloading. I'm not profficient in C# to know the different syntax, can someone please give me a hand on this simple question?
>
>Thanks a lot in advance.

Naomi,
Maybe try to break it up a little to debug. Something like so (this is in VB):
Dim x As String
x = "I'm a boy"
x = Server.URLEncode(x)
x = x.Replace("'","\'")
View x after every line. Does this help at all?
Very fitting: http://xkcd.com/386/
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform