Solved

c# replace method

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

914 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now