|
-
Jul 13th, 2001, 01:26 PM
#1
Thread Starter
Fanatic Member
Remove text from end of string
I have a page that lists all the files in the folder. How can I remove the extension from the string containing the file name? For example: file1.asp -> file1, somepage.html -> somepage, etc.
Alcohol & calculus don't mix.
Never drink & derive.
-
Jul 13th, 2001, 05:20 PM
#2
Well, without writing the code for you:
1) get the file name in a variable.
2) Loop through the file name until you find a "."
3) Find out how many characters are after the "." So, for .asp it would be 3. For .html it would be 4.
4) Do a replace on your variable, replacing the Right 4 characters of your variable with nothing.
HTH
BTW, what the heck is that picture you have under your name, and better yet, what the hell is he doing?
-
Jul 13th, 2001, 06:29 PM
#3
-
Jul 13th, 2001, 06:31 PM
#4
Thread Starter
Fanatic Member
Well, the program I got it from says he is "fidgeting."
Alcohol & calculus don't mix.
Never drink & derive.
-
Jul 13th, 2001, 07:27 PM
#5
VB Code:
Function StripEXT(FileName)
Dim SplitData
Dim i
SplitData = Split(FileName, ".")
For i = 0 to UBound(SplitData) - 1
If i = 0 Then
StripEXT= SplitData(i)
Else
StripEXT= StripEXT& "." & SplitData(i)
End If
Next
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|