Results 1 to 5 of 5

Thread: trim off extension

  1. #1

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    I have some code that when you click on the filebox, it adds the filename to a path i.e. D:\Quake2\baseq2\maps\default.bsp. Is there a way to trim off the last 4 characters? (in bold).

    Thanks
    <removed by admin>

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    if u want to put it into a textbox it would be:
    Code:
    Text1.Text = Left(Text1.Text, Len(Text1.Text) - 4)
    you can do with that what u need to do
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    thanks
    <removed by admin>

  4. #4
    Guest
    The following method is more accurate.
    Code:
    sName = "MyFile.exe"
    Print Left(sName, InStrRev(sName, ".") - 1)
    It will allow for an extension of any length (e.g html or hc which are not the standard 3 length) whereas the above example does not.

  5. #5

    Thread Starter
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    Thanks megatron, but that method doesn't really apply to what I am doing because all the files have the same extension (.bsp). If it has a different extension, it won't show up in the file box since the pattern is *.bsp. Thanks though, I'll save that code for later, because I searched for it along time ago and couldn't find it.

    [Edited by MidgetsBro on 11-25-2000 at 08:43 PM]
    <removed by admin>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width