1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

asp.net c# How do I remove all symbols (for example "\") from a text string

Discussion in 'C#' started by t7584, Dec 13, 2006.

  1. #1
    asp.net c#

    How do I remove all symbols (for example "\") from a text string.
    example
    55555\444444
    must be 55555444444
    SEMrush
     
    t7584, Dec 13, 2006 IP
    SEMrush
  2. MrWize

    MrWize Peon

    Messages:
    54
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    string cleanString = dirtyString.Replace("\\","");

    .NET Framework SDK is an amazing thing to have i handy. Lot of code examples ;)

    cya,
    /PatrikB
     
    MrWize, Dec 13, 2006 IP
  3. shaileshk

    shaileshk Well-Known Member

    Messages:
    455
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #3
    shaileshk, Dec 14, 2006 IP
  4. CSPlayer

    CSPlayer Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    This will remove all non alpha-numeric characters if that is what you are looking for

    string cleanString = Regex.Replace(dirtyString, "[^A-Za-z0-9]", "");
     
    CSPlayer, Dec 14, 2006 IP
  5. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,607
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #5
    if it's just one char - use the Safe old Replace function

    Candy = Replace(Candy, "\", "")
    and if you need to replace the " character itself, just replace chr(34)
     
    ccoonen, Dec 30, 2006 IP
  6. ksenthil

    ksenthil Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    this was good one. Thanks peon.
    string cleanString = Regex.Replace(dirtyString, "[^A-Za-z0-9]", "");
     
    ksenthil, Feb 8, 2007 IP