Solved

c# replace method

Posted on 2014-02-17
5
177 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
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 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