Solved

c# replace method

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

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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 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

23 Experts available now in Live!

Get 1:1 Help Now