Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

c# replace method

Posted on 2014-02-17
5
Medium Priority
?
187 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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.…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

722 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