in code/Utils/TopicUtils.cs [24:52]
public static string RemoveHashtags(string text)
{
// skip empty strings
if (string.IsNullOrWhiteSpace(text))
{
return text;
}
// walk through the string
int i = text.IndexOf("#", 0);
while (i > -1 && i < (text.Length - 1))
{
// hashtags start with # (i.e. start of string or whitespace followed by #)
if (i == 0 || char.IsWhiteSpace(text[i - 1]))
{
// hashtags must have 1 non-whitespace character after the #
if (!char.IsWhiteSpace(text[i + 1]))
{
// insert a space
text = text.Insert(i + 1, " ");
}
}
// continue searching from right after the #
i = text.IndexOf("#", i + 1);
}
return text;
}