Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# replace command
Message
De
16/01/2008 11:19:29
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
OS:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01282218
Message ID:
01282279
Vues:
13
This message has been marked as a message which has helped to the initial question of the thread.
>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?



Maybe I did not understand, is this what you want?
string x = "I'm a girl";
x = Server.UrlEncode(x).Replace("'", "\\'"));

returns: "I\'m+a+girl"
Craig is correct, you need to escape the backslash in C#.


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform