Restored from previous forum. Originally posted by PB.
We have GetFilePart and GetPathPart, so please consider GetExtPart to retrieve
the file extension of a given string.
PB - Registered PureBasic Coder
[Implemented] Req: GetExtPart
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by tranquil.
ext$=right(filename$,3) to get the last 3 characters
Mike
Tranquilizer/ Secretly!
Registred PureBasic User
Ohhhh dear!!We have GetFilePart and GetPathPart, so please consider GetExtPart to retrieve
the file extension of a given string.
PB - Registered PureBasic Coder
ext$=right(filename$,3) to get the last 3 characters
Mike
Tranquilizer/ Secretly!
Registred PureBasic User
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Franco.
Sorry Tranquil but this doesn't work every time.
The reason is that if you have a file like:
MyBiggestFile.pb
you have only 2 chars in the extension.
Or if you have:
MyBiggestFile.manifest
you have more than 3.
You can't search for a dot with FindString and say: on the right side from the dot is the extension because you can have files like:
MyBiggestFile.3v1.exe
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
Edited by - franco on 02 May 2002 17:02:30
Sorry Tranquil but this doesn't work every time.
The reason is that if you have a file like:
MyBiggestFile.pb
you have only 2 chars in the extension.
Or if you have:
MyBiggestFile.manifest
you have more than 3.
You can't search for a dot with FindString and say: on the right side from the dot is the extension because you can have files like:
MyBiggestFile.3v1.exe
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
Edited by - franco on 02 May 2002 17:02:30
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
> ext$=right(filename$,3) to get the last 3 characters
As Franco said, what if the extension is not 3 chars, or the string to be
tested has a closing quote? For example, what if filename$ contained:
PureBasicSource.pb
"C:\OtherExample.txt"
WebDocument.shmtl
Dot.In.FileName.zip
Anyway, I have posted an working tip in the Tricks 'N' Tips section, until
Fred can add such a command, if he agrees to one.
PB - Registered PureBasic Coder
Edited by - PB on 02 May 2002 23:35:21
> ext$=right(filename$,3) to get the last 3 characters
As Franco said, what if the extension is not 3 chars, or the string to be
tested has a closing quote? For example, what if filename$ contained:
PureBasicSource.pb
"C:\OtherExample.txt"
WebDocument.shmtl
Dot.In.FileName.zip
Anyway, I have posted an working tip in the Tricks 'N' Tips section, until
Fred can add such a command, if he agrees to one.
PB - Registered PureBasic Coder
Edited by - PB on 02 May 2002 23:35:21