Thread: deleting charector from a string

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    10

    deleting charector from a string

    OK is it possable to delete an charactor from a string, ' " ' and ' , ' to be persise, now i got a feeling you can but, i have no idea how or even where to begin. any help would be helpful.

    also as a side note, where is the best place ot find C# tutorals? because what i've found so far, tend to be over the top or strang.

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Strings are immutable so you can't actually remove it, you can however create a new string with those characters removed.
    Code:
    string NewString = OldString.Replace("\"", "").Replace(",", "");
    If performance is an issue it might be better to use a StringBuilder instead.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Custom String class gives problem with another prog.
    By I BLcK I in forum C++ Programming
    Replies: 1
    Last Post: 12-18-2006, 03:40 AM
  2. Linked List Help
    By CJ7Mudrover in forum C Programming
    Replies: 9
    Last Post: 03-10-2004, 10:33 PM
  3. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 03:23 PM
  4. creating class, and linking files
    By JCK in forum C++ Programming
    Replies: 12
    Last Post: 12-08-2002, 02:45 PM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM