Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
サブカテゴリが何度も繰り返されたというリンクがあります。また、特定のリストにある場合にのみ繰り返しを保持したい。ただし、リンクの最後の部分も保持してください ビデオについて Example1 Example2
www.example.com/About/About/Videos/Videos/Videos/Featured/5-great-videos
する必要があります
www.example.com/about/videos/5-great-videos
何か助けはありますか?
LINQを使用して、これはどうですか
string str = "www.example.com/About/About/Videos/Videos/Videos/Featured/5-great-videos"; var result = str.Split('/').GroupBy(x=>x).Select(x=>x.Key).Aggregate((a,b)=>a+"/"+b);