Search⌘ K
AI Features

Solution: Hashtag Extractor

Explore how to extract hashtags from input strings in C# by handling null or empty values, splitting sentences into distinct words, and collecting valid hashtags. Understand how to verify results and handle edge cases while practicing string processing techniques in .NET.

We'll cover the following...
C# 14.0
var processor = new HashtagProcessor();
string post1 = "Learning modern C# is #fun and #rewarding today!";
string post2 = "Just a normal post without any tags.";
string post3 = "#coding #csharp #dotnet are my favorite topics.";
string post4 = " ";
string post5 = "The event is #Awesome!";
Console.WriteLine($"Post 1 Tags: {processor.ExtractTags(post1)}");
Console.WriteLine($"Post 2 Tags: {processor.ExtractTags(post2)}");
Console.WriteLine($"Post 3 Tags: {processor.ExtractTags(post3)}");
Console.WriteLine($"Post 4 Tags: {processor.ExtractTags(post4)}");
Console.WriteLine($"Post 5 Tags: {processor.ExtractTags(post5)}");
...