anzacfalcon Posted December 2, 2009 Share Posted December 2, 2009 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 More sharing options...
99ojo Posted December 2, 2009 Share Posted December 2, 2009 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 More sharing options...
anzacfalcon Posted December 2, 2009 Author Share Posted December 2, 2009 (edited) Thank's mate. Other suggestions are welcome. Edited December 2, 2009 by anzacfalcon Link to comment Share on other sites More sharing options...
Mat Posted December 2, 2009 Share Posted December 2, 2009 (edited) StringRegExpReplace ($sURL, "^.*/", "") or: StringTrimLeft ($sURL, StringInStr ($sURL, "/", 2, -1)) both work the same, Depends if you want to use the regex library. Mat Edited December 2, 2009 by Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now