Re: how do I get just one \, problem with escape sequence



Hi,

Both solutions You written is good for this case, and You are actually getting c:\GotoWebSite.aspx, but when You look at a strings value, VS will show it with escape chars, so it will shown with \\ but its actually \ :)

Hope You find this useful.
-Zsolt

"chasgl" <chasgl@xxxxxxxxxxxxxxxxxxxxxxxxx> az alábbiakat írta a következő üzenetben news:7AF8D99B-5CC8-481B-88FB-77E05D674778@xxxxxxxxxxxxxxxx

I am using Visual Studio 2009 creating a c# program. I want to create a
string c:\GoToWebSite.aspx when I try to do it this way :
string FileStr = “c:\GoToWebSite.aspx". I get an error message
Error 3 Unrecognized escape sequence When I try FileStr =
“c:\\GoToWebSite.aspx". The resulting string is c:\\GoToWebSite.aspx. . When
I try FileStr = @“c:\GoToWebSite.aspx.” the resulting string is =
c:\\GoToWebSite. How do I just get c:\GotoWebSite.aspx?

.



Relevant Pages

  • Re: @ sign?
    ... public void Foo(string @string) ... > eliminates escape chars by telling the compiler that it is a verbatim ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: @ sign?
    ... That string will be the same with or without the '@'. ... eliminates escape chars by telling the compiler that it is a verbatim ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Paths, Spaces, Getopt::Long
    ... The path string that is returned from ... Getopt has spaces without escape chars. ... for Perl use, but not so great for other things, such as the Shell ... Stonehenge Perl Training ...
    (perl.beginners)
  • Re: Simple Question..
    ... Use backslash for escape chars: ... > Just wondering how we can build up a string which needs to contain speech ... > mark symbols in the text itself. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: question about string
    ... huhuuh does not contain 'a'. ... string, where escape chars have no effect. ... greenrob a écrit: ...
    (microsoft.public.dotnet.languages.csharp)