I am in need of a function that determines URL occurences in a message (string) and wraps them in <a>
elements.
This is my approach:
function wrapUrl(message){
var content = message.split(' ');
content.forEach(function(item){
// Check if this is an URL and if so, wrap it
});
}
This will be used in a chatroom, thus there will be a lot of messages. Each message is a POJO holding 3 key - value pairs.
Considering performance, is this a good approach or am I missing a easier variant?