Advertisement
Jym_Nova

Find a URL inside a string

Oct 10th, 2019
1,240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Written By: Ĵyм Ѡҩℓƒ (Jym Resident)
  2. /*
  3. LICENCE:
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. any later version.
  8.  
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. GNU General Public License for more details.
  13.  
  14. You should have received a copy of the GNU General Public License
  15. along with this program.  If not, see <http://www.gnu.org/licenses/>.
  16. or you may visit - http://license.idjhost.com/
  17. */
  18. // DESCRIPTION
  19. // Finds url's in a string.
  20.  
  21. string text = "For example, this is a string, and SL will automatically 'URLify' it, but how do I do that myself? https://www.youtube.com/feed/subscriptions";
  22. string find = "http";
  23.  
  24. default{
  25.     state_entry(){
  26.         integer i = 0;
  27.         list temp = llParseString2List(text,[" "],[]);
  28.         integer count = llGetListLength(temp);
  29.         while(i < count){
  30.             if(llGetSubString(llList2String(temp,i),0,3) == "http"){
  31.                 //Found URL
  32.                 llSay(0,llList2String(temp,i));
  33.             }
  34.             i++;
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement