Add tests to Twitch User/Channel name strip functions (#3568)
This commit is contained in:
@@ -10,4 +10,29 @@ void openTwitchUsercard(QString channel, QString username)
|
||||
QDesktopServices::openUrl("https://www.twitch.tv/popout/" + channel +
|
||||
"/viewercard/" + username);
|
||||
}
|
||||
|
||||
void stripUserName(QString &userName)
|
||||
{
|
||||
if (userName.startsWith('@'))
|
||||
{
|
||||
userName.remove(0, 1);
|
||||
}
|
||||
if (userName.endsWith(','))
|
||||
{
|
||||
userName.chop(1);
|
||||
}
|
||||
}
|
||||
|
||||
void stripChannelName(QString &channelName)
|
||||
{
|
||||
if (channelName.startsWith('@') || channelName.startsWith('#'))
|
||||
{
|
||||
channelName.remove(0, 1);
|
||||
}
|
||||
if (channelName.endsWith(','))
|
||||
{
|
||||
channelName.chop(1);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
Reference in New Issue
Block a user