Full string line as copy/pasted from WeeChat.
The nickname to remove (along with the timestamp).
The available user prefixes on the current server.
The original line with the WeeChat timestamp and nickname sliced away, or as it was passed. No new string is ever allocated.
immutable prefixes = "!~&@%+"; { enum line = "20:08:27 @zorael | dresing"; immutable modified = removeWeeChatHead(line, "zorael", prefixes); assert((modified == "dresing"), modified); } { enum line = " 20:08:27 @zorael | dresing"; immutable modified = removeWeeChatHead(line, "zorael", prefixes); assert((modified == "dresing"), modified); } { enum line = "+zorael | dresing"; immutable modified = removeWeeChatHead(line, "zorael", prefixes); assert((modified == "dresing"), modified); } { enum line = "2y:08:27 @zorael | dresing"; immutable modified = removeWeeChatHead(line, "zorael", prefixes); assert((modified == line), modified); } { enum line = "16:08:27 <-- | kameloso (~kameloso@2001:41d0:2:80b4::) " ~ "has quit (Remote host closed the connection)"; immutable modified = removeWeeChatHead(line, "kameloso", prefixes); assert((modified == line), modified); }
Removes the WeeChat timestamp and nickname from the front of a string.