13 Years of Service
92%
Code:
>Func CompGetFileExt($Path,$Dot=True)
;by 1234hotmaster
If StringLen($Path) < 4 Then Return -1
$ret = StringSplit($Path,"\",2)
If IsArray($ret) Then
$ret = StringSplit($ret[uBound($ret)-1],".",2)
If IsArray($ret) Then
If $Dot Then
$Dot = "."
Else
$Dot = ""
EndIf
Return $Dot & $ret[uBound($ret)-1]
EndIf
EndIf
If @error Then Return -1
EndFunc
Code:
>Func CompGetFileName($Path)
;by 1234hotmaster
If StringLen($Path) < 4 Then Return -1
$ret = StringSplit($Path,"\",2)
If IsArray($ret) Then
Return $ret[uBound($ret)-1]
EndIf
If @error Then Return -1
EndFunc
Code:
>Func CompGetParentDir($Path,$EndSeparator=False)
;by 1234hotmaster
If StringLen($Path) < 4 Then Return -1
$ret = StringSplit($Path,"\",2)
If IsArray($ret) Then
Local $temp
For $i = 0 To UBound($ret)-2
$temp &= $ret[$i] & "\"
Next
If Not $EndSeparator Then $temp = StringTrimRight($temp,1)
$ret=Chr(0)
Return $temp
EndIf
If @error Then Return -1
EndFunc