Private Sub Form_Load() RichTextBox1.FileName = "c:\test.txt" End Sub Private Sub Command1_Click() ' txt en mémoire (plus rapide que dans le composant !) Dim sText As String sText = RichTextBox1.Text ' tant qu'on a du texte commençant par "http://www.monsite.fr/images/", ' on supprime ce texte jusqu'au préfixe (NUMERO) inclus Dim lPosL As Long, lPosR As Long Do While InStr(1, sText, "http://www.monsite.fr/images/") lPosL InStr(1, sText, "http"): lPosR InStr(lPosL + 1, sText, "img") If lPosL > 0 And lPosR > 0 Then sText = Left$(sText, lPosL - 1) & Mid$(sText, lPosR + 4) Loop ' affichage RichTextBox1.Text = sText End Sub
dim sep()as string,sp()as string,i as long 'on découpe le texte suivant le lien sep = split(txt,"http://www.monsite.fr/images/dvd/img_") 'on le parcours for i = 0 to ubound(sep) 'on decoupe le lien sp = split(sep(i),".jpg") 'on ajoute le nom de chaque photo dans une liste list1.additem sp(0) & ".jpg" next
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questiondim sep()as string,sp()as string,i as long 'on découpe le texte suivant le lien sep = split(txt,"/img_") 'on le parcours for i = 1 to ubound(sep) 'on decoupe le lien sp = split(sep(i),".jpg") 'on ajoute le nom de chaque photo dans une liste list1.additem sp(0) & ".jpg" next
Dim sep() As String, sp() As String, i As Long 'on découpe le texte suivant le lien sep = Split(Text1, "http") 'on le parcours For i = 1 To UBound(sep) 'on decoupe le lien sp = Split(sep(i), "/img_") Text1 = Replace(Text1, sp(0), "_--_") Next Text1 = Replace(Text1, "http_--_/", "") Next
Dim variable1 As String, variable2 As String Demarre1 = LCase(Replace(LCase("http"), "", vbCrLf)) Stop1 = LCase(Replace(LCase("_"), "", vbCrLf)) While InStr(1, RichTextBox1.Text, Demarre1) > 0 And InStr(1, RichTextBox1.Text, Stop1) > 0 DoEvents variable1 = InStr(1, RichTextBox1.Text, Demarre1) variable2 = InStr(variable1, RichTextBox1.Text, Stop1) RichTextBox1.Text = Mid(RichTextBox1.Text, 1, variable1 - 1) & Mid(RichTextBox1.Text, variable2 + -1) Wend