Code:
'******************************************************************************* '* (C) M.Hoffmann '* Unit: fileid1.pbl '* Zweck: Zerlegung von Dateinamen, extrahieren der Einzelbestandteile von '* von Dateinamenn (ohne Truenamefunktion) als Weiterentwicklung von '* 'fileidsplit' aus der Unit 'os_callx' mit UNC-Unterstützung. '* Version: 1.00 '* Stand: 05.11.97 '* Sprache: PowerBASIC 3.2 '* Autor: (C) M.Hoffmann, Wedeler Landstr.139, 22559 Hamburg. '* Benötigt: '* Historie: '* 1.00: Erste Version, 13.-14.10.97, 05.11.97. '* Notizen: '* '******************************************************************************* ' c: fileid1 .pbu 3745 5.11.97 8:01 v1.00 ' '---Compiler-------------------------------------------------------------------- $compile unit $cpu 80386 $debug map-,pbdebug-,path-,unit- $dim all $error all- $event off $float emulate $lib all- $optimize size $static $option gosub-,signed- defint a-z '---Deklarationen--------------------------------------------------------------- '---Unit-Shared Variablen------------------------------------------------------- '---Schnittstellen-------------------------------------------------------------- '---Routinen-------------------------------------------------------------------- sub fidSplit (Spe as string, _ Drv as string, _ Pth as string, _ Nam as string, _ Ext as string) local public dim i as local integer dim j as local integer dim rst as local string if left$(Spe,2) = "\\" then i = instr(3,Spe,"\") if i then i = instr(i+2,Spe,"\") if i then Drv = left$(Spe,i-1) rst = mid$(Spe,i) end if end if elseif instr(Spe,":") = 2 then drv = left$(Spe,1) rst = mid$(Spe,3) else drv = "" rst = Spe end if i = 0 for j = len(rst) to 1 step -1 if ascii(mid$(rst,j,1)) = 92 then '\' i = j exit for end if next if i > 0 then Pth = left$(rst,i) rst = mid$(rst,i+1) else pth = "" end if Nam = extract$(rst,".") Ext = mid$(rst,len(Nam)+2) end sub '------------------------------------------------------------------------------- function fidUNC (Spe as string) local public as integer function = (left$(spe,2) = "\\" and instr(3,spe,"\") > 0) end function '------------------------------------------------------------------------------- function fidDrive (Spe as string) local public as string dim tmp as local string fidSplit Spe,tmp,"","","" if fidUNC(Spe) then function = tmp else function = tmp+":" end if end function '------------------------------------------------------------------------------- function fidDrive2 (Spe as string) local public as string dim tmp as local string fidSplit Spe,tmp,"","","" function = tmp end function '------------------------------------------------------------------------------- function fidPath (Spe as string) local public as string dim tmp as local string fidSplit Spe,"",tmp,"","" function = tmp end function '------------------------------------------------------------------------------- function fidPath2 (Spe as string) local public as string dim tmp as local string fidSplit Spe,"",tmp,"","" if len(tmp) then function = left$(tmp,len(tmp)-1) end if end function '------------------------------------------------------------------------------- function fidName (Spe as string) local public as string dim tmp as local string fidSplit Spe,"","",tmp,"" function = tmp end function '------------------------------------------------------------------------------- function fidExt (Spe as string) local public as string dim tmp as local string fidSplit Spe,"","","",tmp function = tmp end function '===============================================================================