Ecco due funzioni:
Function sinistra(s As String) As Integer Dim numero As Integer If InStr(s, "/") <> 0 Then numero = InStr(s, "/") - 1 Else numero = Len(s) End If sinistra = CInt(Left(s, numero)) End FunctionIsola il numero precedente lo slash.
Per l'altra ci devo ragionare.
Se non c'è slash, InStr è pari a zero, e quindi il valore della funzione destra deve essere zero.
Eccola:
Function destra(s As String) As Integer If InStr(s, "/") <> 0 Then destra = Asc(Right(s, Len(s) - InStr(s, "/"))) Else destra = 0 End If End Function
Nessun commento:
Posta un commento