Jump to content

Getting Filename from a URL


Recommended Posts

I have a userinput which contains a full URL. Want i want to do is extract the filename from the URL and use it for something else. I was thinking String Manipulation functions would be used unless anybody knows of a better way. For example, "www.example/com/files/test.exe". What i was thinking was to somehow get the string between the last occurrence of "/" from the right and the rest of the strings to the right of it. Thanks for listening.

Link to comment
Share on other sites

I have a userinput which contains a full URL. Want i want to do is extract the filename from the URL and use it for something else. I was thinking String Manipulation functions would be used unless anybody knows of a better way. For example, "www.example/com/files/test.exe". What i was thinking was to somehow get the string between the last occurrence of "/" from the right and the rest of the strings to the right of it. Thanks for listening.

Hi,

many ways, here's one:

$string = "www.example/com/files/test.exe"
$var = StringSplit ($string, "/")
MsgBox (0,"", $var [UBound ($var) - 1])

;-))

Stefan

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...