Solved

c# replace method

Posted on 2014-02-17
5
179 Views
Last Modified: 2014-02-17
I try to replace \ to string.empty like the following code, but it never works. Can you show me the right way to do that?


(firstName.Text).Replace(@"\", "")
0
Comment
Question by:CoolDev2014
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 39865629
Replace usually returns the converted string.
Something like this:
firstName.Text = (firstName.Text).Replace(@"\", "")
0
 

Author Comment

by:CoolDev2014
ID: 39865646
but i have something like below
string fileName = genericSrv.Encryption(firstName.Text).Replace(@"\", "")
how can i do that?
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 39865669
Is this what you want to do?
string fileName = genericSrv.Encryption((firstName.Text).Replace(@"\", ""))
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39865964
*no points*

I agree with Andy's assessment:  You wouldn't want to change the encrypted string because you might not be able to restore it back. It sounds like you intended to modify the pre-encrypted string, and then to encrypt that result, which is what Andy's code demonstrates.
0
 

Author Comment

by:CoolDev2014
ID: 39866010
andy: another excellent help. If you have time, I have another one for you.

http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_28366375.html
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Run tasks synchronously in background thread 19 82
Broken .resx file generating errors 18 44
Data Analysis 7 59
Which is best Image Resizing Web service 11 42
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question