how to replace “\” with “_” in string in c#.net

(In order to Enlarge images Please Right Click and Open images in New Tab).

 

2

Let’s see how to replace “\” with “_” in string in c#.net

Since it’s not straight forward by using String.Replace method.

So let’s take move ahead with it

suppose your string item is like that
string filepath=”C:\\\\DemoFolder\\Claims”;

now use below code

filepath.Replace(@”\”, @”_”);

Output=>  “C:__DemoFolder_Claims”

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s