| |
|
|
Michael Wodrich | Filenames aufdröseln ex Version 10.0 (uses SubStr backward and Match$) CompileMarkSeparationSplitFilename (Test-Schnipsel)
Ab XProfan 10
Proc SplitFilename
Parameters Vollname$
Declare Laufwerk$, Pfad$, Datei$, Extension$
Laufwerk$ = Match$(.:,Vollname$)
Pfad$ = Match$(~.{0,2}\(.*\)?,Vollname$)
Datei$ = SubStr$(Vollname$,-1,If(InStr(\,Vollname$),\,:))
Extension$ = If(InStr(.,Datei$),SubStr$(Datei$,-1,.),)
AddString Voller Dateiname: q + Vollname$ + q
AddString Laufwerk + MkStr$(.,8) + : q + Laufwerk$ + q
AddString Pfad + MkStr$(.,12) + : q + Pfad$ + q
AddString Dateiname + MkStr$(.,7) + : q + Datei$ + q
AddString Extension + MkStr$(.,7) + : q + Extension$ + q
AddString
EndProc
ClearList
SplitFilename C:
SplitFilename Datei
SplitFilename Datei.
SplitFilename C:Datei.ext
SplitFilename C:Datei.ext
SplitFilename C:TestDatei
SplitFilename C:Test.$$$Datei.ext
SplitFilename C:Test.$$$Datei.
SplitFilename C:Test.$$$Datei
SplitFilename .Text.$$$
SplitFilename ....von weiter vorndatei.ext
ListBox$(die Ergebnisse,2)
VVV damit habe ich mal schnell die Ergebnisse abgegriffen
Declare s$,B#
Dim B#,50000
MoveListToMem(B#,
)
BlockWrite C:\Test_Splitfilename.txt,B#,0,Len(String$(B#,0))
Dispose B#
ShellExec(C:\Test_Splitfilename.txt,open,1)
End
and the Results:
Voller Dateiname: C: drive........: C: way............: Dateiname.......: Extension.......:
Voller Dateiname: File drive........: way............: Dateiname.......: File Extension.......:
Voller Dateiname: File. drive........: way............: Dateiname.......: File. Extension.......:
Voller Dateiname: Catei.ext drive........: C: way............: Dateiname.......: File.ext Extension.......: ext
Voller Dateiname: Catei.ext drive........: C: way............: Dateiname.......: File.ext Extension.......: ext
Voller Dateiname: C:TestDatei drive........: C: way............: Test Dateiname.......: File Extension.......:
Voller Dateiname: C:Test.$$$File.ext drive........: C: way............: Test.$$$ Dateiname.......: File.ext Extension.......: ext
Voller Dateiname: C:Test.$$$File. drive........: C: way............: Test.$$$ Dateiname.......: File. Extension.......:
Voller Dateiname: C:Test.$$$File drive........: C: way............: Test.$$$ Dateiname.......: File Extension.......:
Voller Dateiname: .Text.$$$ drive........: way............: .Text.$$$ Dateiname.......: Extension.......:
Voller Dateiname: ....of moreover vorndatei.ext drive........: way............: ....of moreover in front Dateiname.......: File.ext Extension.......: ext |
|
|
| Programmieren, das spannendste Detektivspiel der Welt. | 06/16/06 ▲ |
|
|
|
|
| [quote:283141f477=Michael Wodrich] and the Results: [box:283141f477] Voller Dateiname: Catei.ext [/box:283141f477][/quote:283141f477] there missing one Backslash you should The Laufwerksbuchstaben too with BackSlash give back, any API-Aufrufe to accept in general both, means C: and C:, so the it with Backslash uniformly would. otherwise very useful. |
|
|
| |
|
|
|
Michael Wodrich | isn't integrally correctly. with the Backslash.
The File can Yes in *each* directory on drive C: his, as they so indicated is.
and it is not The task one Splitters for a complete names To care. then wären namely too The .. any aufgelöst been.
sometimes need one just a Namens-Verhackstücker, because one one part of it replace would like.
correctly would though, whom Filenames from the expansion To release. then reicht one simple add the pieces and one has again Ganzes (therefore: drive only the character and colon).
is with whom Snippets debarked, because one itself there Yes what draus divert can.
In each drop goes it now with XProfan 10 everything something kürzer To write.
Best wishes Michael Wodrich |
|
|
| Programmieren, das spannendste Detektivspiel der Welt. | 06/16/06 ▲ |
|
|
|
|
Jac de Lad | Gibts dafpr not too ne API? I mean, if I a Filenames whom way extract wants, I could the degree well use, find the but not. |
|
|
| Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE) Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP | 03/07/07 ▲ |
|
|
|
|
| |
|
|
|
| Michael Wodrich
isn't integrally correctly. with the Backslash.
The File can Yes in *each* directory on drive C: his, as they so indicated is.
quite correctly because if itself one Process z.B. via chdir on d: befinded, before but to c:sonstwasirgendwas changed watts - so would The indicated of C:my.File on c:sonstwasirgendwasmeine.File show, instead of on c:my.File.
Michaels Algo working IMHO utterly correctly.. |
|
|
| |
|
|
|
Jac de Lad | |
|
| Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE) Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP | 03/08/07 ▲ |
|
|
|