Is there a way to understand if a given string is a web URL?

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Is there a way to understand if a given string is a web URL?

Post by Mag » Thu Apr 11, 2013 4:46 pm

Hi all, somebody of the gurus of the forum, know if there is a quick way to check if a string is a web url?

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Is there a way to understand if a given string is a web

Post by jmburnod » Thu Apr 11, 2013 5:59 pm

HI Mag

Why not

Code: Select all

put  ("http://" is in MyString) into tIsUrl
Best regards
Jean-Marc
https://alternatic.ch

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: Is there a way to understand if a given string is a web

Post by Mag » Fri Apr 12, 2013 11:38 am

Thank you jmburnod

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Is there a way to understand if a given string is a web

Post by jmburnod » Fri Apr 12, 2013 1:23 pm

Hi Mag
Welcome.
Please let we know if that is a good way
Best regards
Jean-Marc
https://alternatic.ch

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: Is there a way to understand if a given string is a web

Post by Mag » Fri Apr 12, 2013 4:38 pm

Yes, I also added a check for learn if the string is at the begin of the text (which have to have one line only) or if the strings starts with "www"...

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: Is there a way to understand if a given string is a web

Post by shaosean » Sat Apr 13, 2013 7:32 am

If you have internet access, you can always try to connect to the URL (a success means it is valid, but a failure does not always mean it is invalid)..

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: Is there a way to understand if a given string is a web

Post by Mag » Sat Apr 13, 2013 10:53 am

Thank you so much guys!

andrewferguson
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 184
Joined: Wed Apr 10, 2013 5:09 pm

Re: Is there a way to understand if a given string is a web

Post by andrewferguson » Tue May 07, 2013 6:55 pm

Hi,
launch URL "url-to-launch"
will be the code that you want to launch a URL.

Andrew

Post Reply

Return to “Mac OS”