loxodrome | Hello
Merci beaucoup pour ton bout de code, j'ai vu ton message privé mais quelques explication serait le bien venu si je peux te le demander.
Code :
- Private Sub Test()
- Dim s As String
- s = "RI1 456400.00000 0.237"
-
- La je ne comprend pas DebuG
- Debug.Print FormaterChaine(s)
- s = "RI2000 12890.00001235 1.200"
- Debug.Print FormaterChaine(s)
- s = "RI300 1212.007895632 12311.200"
- Debug.Print FormaterChaine(s)
- End Sub
|
Code :
- Private Function FormaterChaine(ByVal Chaine As String) As String
- Dim strG As String, strM As String, strD As String
- Dim strEspaceL As String, strEspaceR As String
- Dim PosEspace As Integer, PosDecimal As Integer
- Les constante espace ?
- Const Espace As String * 1 = " "
- Const Decim As String * 1 = "."
- ' Position séparateur décimal
- En fait ca change tjrs en fonction du nombre de chiffre avant et après ??
- Const PosChaineM As Integer = 40
- Const PosChaineR As Integer = 72
- Je ne comprend pas strG
- PosEspace = InStr(Chaine, Espace)
- strG = Left(Chaine, PosEspace - 1)
-
- 'comprend pas la InStrRev
- PosEspace = InStrRev(Chaine, Espace)
- strD = Right(Chaine, Len(Chaine) - PosEspace)
- 'je ne comprend pas la fonction TRIM
- strM = Trim(Mid(Chaine, Len(strG) + 1, Len(Chaine) - Len(strD) - Len(strG)))
-
- PosDecimal = InStr(strM, Decim)
-
- strEspaceL = String(PosChaineM - Len(strG) - PosDecimal, Espace)
-
- PosDecimal = InStr(strD, Decim)
- strEspaceR = String(PosChaineR - Len(strG) - Len(strEspaceL) - Len(strM) - PosDecimal, Espace)
-
- FormaterChaine = strG & strEspaceL & strM & strEspaceR & strD
- End Function
|
En fait si je comprend bien Len(strG) renvoie le nombre de caractère de la variable strG et Len(
Oui l'alignement ce fait par les séparateur décimale
En fait c'est presque pour le même domaine d'activité, en fait c'est pour transformer une fichier résultat de mesure en un fichier comptatible avec le logiciel de compensation LTOP.
Structure fichier 1
1. No Point : 1 direction moyenne: 0.00000g
Haut.Réflt. : 0.2370m[/cpp]
en fait les datas 2 doivent être aligne au point à la colonne 73
Merci pour tes conseilles qui me dépatouille pas mal !!!!!!
|