61 lines
1.7 KiB
VB.net
61 lines
1.7 KiB
VB.net
'
|
|
' libreria : VBlib
|
|
' file : L_File_aux
|
|
'
|
|
' funzioni : routines aux sui nomi file
|
|
'
|
|
' copyright 2008-2015 C.Viviani
|
|
'
|
|
Module L_File_aux
|
|
|
|
Function clear_ending_bar(ByVal a As String) As String ' clear the eventual ending "\" in a directory name
|
|
a = Trim(a)
|
|
If (Right$(a, 1) = "\") Then
|
|
a = Left$(a, Len(a) - 1)
|
|
End If
|
|
clear_ending_bar = a
|
|
End Function
|
|
|
|
Function add_ending_bar (ByVal s As String) As String
|
|
If Len(s) > 0 Then
|
|
If Right$(s, 1) <> "\" Then
|
|
add_ending_bar = s + "\"
|
|
Else
|
|
add_ending_bar = s
|
|
End If
|
|
Else
|
|
add_ending_bar = "\"
|
|
End If
|
|
End Function
|
|
|
|
Function clear_starting_point(ByVal a As String) As String ' clear the eventual starting "." in a file ext
|
|
a = Trim(a)
|
|
If (Left$(a, 1) = ".") Then
|
|
a = Right$(a, Len(a) - 1)
|
|
End If
|
|
clear_starting_point = a
|
|
End Function
|
|
|
|
Function true_false_from_yes_no(ByVal a As String) As Boolean
|
|
a = UCase$(a)
|
|
true_false_from_yes_no = False
|
|
If InStr(a, "Y") Then true_false_from_yes_no = True
|
|
If InStr(a, "S") Then true_false_from_yes_no = True
|
|
End Function
|
|
|
|
Function clear_starting_forward_bar(ByVal a As String) As String ' clear the eventual initial "/"
|
|
a = Trim(a)
|
|
If (Left$(a, 1) = "/") Then
|
|
a = Right$(a, Len(a) - 1)
|
|
End If
|
|
clear_starting_forward_bar = a
|
|
End Function
|
|
|
|
Function trim_to_n_char(ByVal a As String, ByVal n As Integer) As String
|
|
a = Trim(a)
|
|
If Len(a) > n Then a = Left$(a, n)
|
|
trim_to_n_char = a
|
|
End Function
|
|
|
|
End Module
|