Thread: how do I replace two backslash characters in a string with a single backclash in C#

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    39

    how do I replace two backslash characters in a string with a single backclash in C#

    I get a string which have the issue is it has double backslashes
    something like
    "C:\\WIP\\C#\\bin\\Debug"
    I want t replace the double backslashes with a single backslash to look like this
    "C:\WIP\C#\bin\Debug"

    Thanks.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 12-25-2017, 03:33 AM
  2. Replies: 6
    Last Post: 05-30-2012, 03:37 PM
  3. Replies: 2
    Last Post: 02-06-2010, 11:45 AM
  4. Replies: 15
    Last Post: 11-12-2008, 06:12 PM
  5. How to read single characters in a string
    By MaxxMan-X in forum C++ Programming
    Replies: 3
    Last Post: 01-22-2005, 02:52 PM