[Gambas-user] R: How to get all string after last "/"

paulwheeler paulwheeler at ...546...
Fri Aug 23 05:05:26 CEST 2013


   Here is the code to do the extraction:
   Dim intSlash As Integer
       Dim strPictureName As String
       Dim strLinkAddress As String =
   [1]"http://www.link1.com/folder1/folder1/picture1.png"
       '' Find location of last slash in address:
       intSlash = RInStr(strLinkAddress, "/")
       '' Extract information starting after that slash:
       strPictureName = Right$(strLinkAddress, Len(strLinkAddress) - intSlash)
       '' Voila! strPictureName is now just the filename and extension!
       Print "strPictureName = " & strPictureName
   Paul

   On 08/22/2013 01:06 PM, abbat81 wrote:

Jussi Lahtinen wrote

You can use InStr() to find "png" and count back to "/".

Ok, how to count back to last "/" in string if we have:

Dim s As String = [2]"http://www.link1.com/folder1/folder1/picture1.png"
Print InStr(s, ".png")

 => 46



--
View this message in context: [3]http://gambas.8142.n7.nabble.com/How-to-get-al
l-string-after-last-tp42952p42961.html
Sent from the gambas-user mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
[4]http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Gambas-user mailing list
[5]Gambas-user at lists.sourceforge.net
[6]https://lists.sourceforge.net/lists/listinfo/gambas-user

References

   1. http://www.link1.com/folder1/folder1/picture1.png
   2. http://www.link1.com/folder1/folder1/picture1.png
   3. http://gambas.8142.n7.nabble.com/How-to-get-all-string-after-last-tp42952p42961.html
   4. http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
   5. mailto:Gambas-user at lists.sourceforge.net
   6. https://lists.sourceforge.net/lists/listinfo/gambas-user



More information about the User mailing list