Click here to Skip to main content
15,901,373 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
string strOriginal;
        string strReplace;
        strOriginal = "01acdfb\\pallavi";
        strReplace = strOriginal.Replace(@"\\", @"\");
        Label1.Text = strReplace;

its give me output in single backslash form but in actual, it will not convert it into single slash form it affect my next step because after getting that single slash output my another requirement is that i have to convert that single slash unicode string into russian code
Posted
Updated 2-May-11 5:35am
v3

Hi,
What you see in designer is "01acdfb\\pallavi" and there is actually 1 "\" there
Do NOT confuse:
C#
strOriginal = "01acdfb\\pallavi";
strOriginal_v2 = @"01acdfb\pallavi"; // There 2 are the same in nature they both have same string

then
C#
strReplace = strOriginal.Replace(@"\\", @"\"); 

Will do NOTHING because there is no double backslash there.
 
Share this answer
 
v2
Comments
RaviRanjanKr 2-May-11 11:34am    
Good Answer! My vote of 5 :)
yesotaso 2-May-11 12:08pm    
Thank you.
There is not such thing as "Russian string". More than that, there is not such thing as "Russian script" or Unicode range or subset — there is "Cyrillic", used by Russian, Ukranian, Belorussian, Bulgarian and some other Slavic and many Asian languages. There is not even the "Cyrillic string" — all strings are Unicode in .NET (and practically all modern platforms). In the same way, there is no "Hindi string" or even "Hindi script", there is Devanagari. There is no "Russian code", "Cyrillic code", "Hindi code" or even "Devanagari" — this is Unicode in the form of different UTFs; there are also obsoleted encodings, but not one per language — many of them, unfortunately.

OK, this is a big confusion. Everyone needs to understand Unicode a bit, see http://unicode.org/[^].
See also UTF FAQ: http://unicode.org/faq/utf_bom.html[^].

Maybe somebody still thinks Unicode is a 16-bit code. Wrong! Read a bit about it, good to know…

—SA
 
Share this answer
 
Hi,

Please check this thread it might help you
Double back slash to Single Slash

Regards
AR
 
Share this answer
 
Comments
pallavi from mumbai 2-May-11 8:16am    
Hi, Thanks but its not help me coz that post has problem...
Ankit Rajput 2-May-11 8:19am    
Which type of problem.
User has already accepted the answer.
pallavi from mumbai 2-May-11 8:25am    
it gives same output at UI part it will appear in single slash format but in actual its not change that...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900