Dim strLine As String = objstreamreader.ReadLine()
If IsNumeric(strLine.Substring(1, 1)) Then
Dim affiche As String
Dim part As String = Mid(strLine, 19, 8)
part = part.Replace(" ", "")
part = part.Replace(",", "")
part = String.Format("000000{0}", part)
part = part.Substring(part.Length - 6, 6)
affiche = strLine.Substring(0, 18) & part
MessageBox.Show(affiche)
End If
Private Sub TextProcessing(Filein As String, Fileout As String)
Dim listIn, listout As New List(Of String)
Dim strright As String
Dim x, y As Integer
Dim max As Integer = 0
listIn = IO.File.ReadAllLines(Filein).ToList
'Recherche le string le plus long après EUR
For Each item In listIn
If item.Substring(item.IndexOf("EUR") + "EUR".Length).Trim.Replace(" ", "").Replace(",", "").Length > max Then
max = item.Substring(item.IndexOf("EUR") + "EUR".Length).Trim.Replace(" ", "").Replace(",", "").Length
End If
x = item.Substring(0, item.IndexOf("EUR") + "EUR".Length).Length
y = item.Substring(x).Length - item.Substring(x).TrimStart.Length
listout.Add(item.Substring(0, item.IndexOf("EUR") + "EUR".Length) + New String(" "c, y))
Next
For iter = 0 To listIn.Count - 1
strright = listIn(iter).Substring(listout(iter).Length).Trim.Replace(" ", "").Replace(",", "").PadLeft(max, "0"c)
listout(iter) = listout(iter) & strright
Next
IO.File.WriteAllLines(Fileout, listout.ToArray)
End Sub
TextProcessing("E:\export\manif.txt","E:\export\export.txt")
mais au même temps j'ai donné l'exemple exacte de mon problème
Merci
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
Modifié par cs_mohellebi le 14/07/2015 à 12:32
Oui effectivement j'aurais dû mentionner de quelle chaîne s'agit-il afin d'être plus explicite , mais au même temps j'ai donné l'exemple exacte de mon problème
Merci