home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,005 of 10,840   
   Rick Rothstein to All   
   Re: truncated filename   
   23 Nov 04 10:24:52   
   
   From: rickNOSPAMnews@NOSPAMcomcast.net   
      
   > Is there an easy way to truncated the name of file name, say from   
   > " C:\my projects\dev\banana.txt" to just "banana.txt"   
   > Do you have to reverse the string and then count from the doit back to   
   > the slash or is there an easier way in VB 6? And go easy on me as I'm   
   > new to VB. :)   
      
   VB has an InStrRev function which does what the InStr function does, but   
   in reverse (that is, it searches from the end of the text, not the   
   beginning). Try this...   
      
        FileName = "C:\my projects\dev\banana.txt"   
        MsgBox Mid$(FileName, InStrRev(FileName, "\") + 1)   
      
   Rick - MVP   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca