sharp-chat/SharpChat.Protocol.SockChat/SockChatExtensions.cs

32 lines
1 KiB
C#
Raw Permalink Normal View History

2022-08-30 15:05:29 +00:00
namespace SharpChat.Protocol.SockChat {
public static class SockChatExtensions {
public static string CleanTextForMessage(this string str) {
return str
.Replace("\t", @" ")
.Replace(@"<", @"&lt;")
.Replace(@">", @"&gt;")
.Replace("\n", @" <br/> ");
}
public static string CleanCommandName(this string str) {
return str.Replace(@".", string.Empty).ToLowerInvariant();
}
public static string CleanTextForCommand(this string str) {
return str
.Replace(@"<", @"&lt;")
.Replace(@">", @"&gt;")
.Replace("\n", @" <br/> ");
}
public static string CleanNickName(this string nick) {
return nick
.Replace(' ', '_')
.Replace("\n", string.Empty)
.Replace("\r", string.Empty)
.Replace("\f", string.Empty)
.Replace("\t", string.Empty);
}
}
}