Hi All,
I'd like to check a sentence for an url and if found switch(replace) it to the appropriate HTML
To give you more of an idea something like this..
none of that is even close to working right now, it's just how I think it might look.
I'd like to check a sentence for an url and if found switch(replace) it to the appropriate HTML
To give you more of an idea something like this..
Code:
//if the start of the string equals "http" or "www"
if(string=='http:'||'[URL unfurl="true"]www.')[/URL]
//then check the end of the string
case 'gif':case 'jpg':case 'jpeg':case 'png':case 'bmp':
result='<img src="'+x+'">';break;
case 'wav':case 'au':case 'mid':case 'aif':case 'ram':case 'mp3':case 'aiff':case 'wma':case 'asf':
result=<bgsound src='x'>;break;
case 'swf':case 'mpg':case 'mpeg':case 'm2p':case 'mp4':case 'qt':case 'vob':case 'rm':case 'avi':case 'wmv':case 'mov':case 'asx':
result=<embed src='x' autostart="true" loop="false" width=640 height=480></embed>;break;
default:
result='<a href='+x+' style="cursor:hand">'+x+'</a>';
none of that is even close to working right now, it's just how I think it might look.