Dim tableau As New List(Of String) Dim ligne As String = "aaaa|bbbb|cccc|dddd" 'remplissage du tableau tableau.AddRange(ligne.Split("|"c)) 'remplacement tableau.Item(tableau.IndexOf("aaaa")) = "1111"
If tableau(0) = "aaaa" Then tableau(0) = Replace(tableau(0), "aaaa", "1111") End If
If tableau(0) = "aaaa" Then tableau(0) = "1111" End If
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionIf tableau(0) = "aaaa" Then tableau(0) = "1111" End If If tableau(2) = "cccc" Then tableau(2) = "2222" End If
Do ligne = monStreamReader.ReadLine() 'la ligne est stockée dans un tableau et on enleve les "|" tableau = Split(ligne, "|") 'on effectue les modifs If tableau(0) = "PA" Then tableau(0) = "JP" End If If tableau(5) = "437720" Then tableau(5) = "647000" End If 'calcul du nombre de colonnes ds le tableau nbtab = UBound(ligneTab) - LBound(ligneTab) + 1 'rajout des "|" dans chaque colonne cpt1 = 0 Do While cpt1 < nbtab ligneTab(cpt1) = ligneTab(cpt1) & "|" cpt1 = cpt1 + 1 Loop ' on renvoi la ligne complete dans une chaine cpt2 = 0 Do While cpt2 < nbtab ligne2 = ligne2 & ligneTab(cpt2) cpt2 = cpt2 + 1 LigneComplete = LigneComplete & ligne2 ligne2 = "" Loop 'on ecrit dans le fichier de sortie monStreamWriter.WriteLine(LigneComplete) LigneComplete = "" Loop Until ligne Is Nothing MsgBox("finni")
Do While cpt2 < nbtab ligne2 = ligne2 & tableau(cpt2) cpt2 = cpt2 + 1 LigneComplete = LigneComplete & ligne2 ligne2 = "" Loop
'rajout des "|" dans chaque colonne cpt1 = 0 Do While cpt1 < nbtab ligneTab(cpt1) = ligneTab(cpt1) & "|" cpt1 = cpt1 + 1 Loop
'la ligne est stockée dans un tableau et on enleve les "|" tableau = Split(ligne, "|") msgbox(tableau(5)) 'on effectue les modifs If tableau(0) = "PA" Then tableau(0) = "JP" End If If tableau(5) = "437720" Then tableau(5) = "647000" End If
Private Function supp_sauts_de_fin(ByVal chaine As String) As String supp_sauts_de_fin = chaine Do While Right(supp_sauts_de_fin, 2) = vbCrLf supp_sauts_de_fin = Left(supp_sauts_de_fin, Len(supp_sauts_de_fin) - 2) Loop End Function