Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Remove duplicate Items from textbox.

Remove duplicate Items from textbox.

Scheduled Pinned Locked Moved C#
questionhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rajendra Rana
    wrote on last edited by
    #1

    I have imported URLs from particular web page into one textbox,there are so many Duplicate URLs are generated.now I want to remove this duplicate URLs from this Text box.On pressing one Button (Click) .How can i do it? can any body help me ! Thnx in Advance. Raj

    M 1 Reply Last reply
    0
    • R Rajendra Rana

      I have imported URLs from particular web page into one textbox,there are so many Duplicate URLs are generated.now I want to remove this duplicate URLs from this Text box.On pressing one Button (Click) .How can i do it? can any body help me ! Thnx in Advance. Raj

      M Offline
      M Offline
      malharone
      wrote on last edited by
      #2

      I'm sure you have some sort of delimiter when the URLs are added to the textbox. E.g http://www.yahoo.com;http://www.msn.com;http://www.google.com; You could split this delimited list using string.split method string[] myURLs = textbox1.Text.Split(';'); ArrayList uniqueURLs = new ArrayList(); foreach(string aURL in myURLs) { if (!uniqueURLs.Contains(aURL)) { uniqueURLs.Add(aURL); } } StringBuilder sb = new StringBuilder(); foreach (string uniqueURL in uniqueURLs) { sb.Append(uniqueURL); sb.Append(";"); } textbox1.Text = sb.ToString(); - Malhar

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups