Option Explicit
Private Sub Essai()
Dim s As String
s = "HIE/RO/PQIW03.50/050N002"
Debug.Print FormaterChaine(s)
s = "HIE/RO/PW04.52/1244N12"
Debug.Print FormaterChaine(s)
End Sub
Private Function FormaterChaine(ByVal Chaine As String) As String
Dim ar As Variant
Dim i As Integer, j As Integer, L As Integer
Dim strTmp As String, Ch As String * 1
ar = Split(Chaine, "/" )
strTmp = ""
For i = 2 To UBound(ar)
L = Len(ar(i))
For j = 1 To L
Ch = Mid(ar(i), j, 1)
If Asc(Ch) = 78 Then Exit For
If Asc(Ch) <= 65 Or Asc(Ch) >= 90 Then
strTmp = strTmp & Ch
End If
Next
ar(i) = strTmp
strTmp = ""
Next
FormaterChaine = ar(2) & "/" & ar(3)
End Function
|