Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Treating lines in a string
Message
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00807738
Message ID:
00807797
Vues:
27
This message has been marked as a message which has helped to the initial question of the thread.
Your code doesn't replace other lines, it ignores them. See corrections below in the code.

>I set up as below
>
> But the problem it's replacing all lines
> Even the lines that does not contain "http://www"
>
>
> lcStr = FILETOSTR("header3.htm")
>
>DIMENSION laLines[1]
>ALINES(laLines, lcStr)
>lcNewTextFile = "header3b.htm"
>lcCrLf = CHR(13) + CHR(10)
>ERASE (lcNewTextFile)
>FOR i=1 TO ALEN(laLines)
> if not empty(laLines[i])  && skip blank lines
>   IF ("http://www" $ laLines[i])
>  STRTOFILE('<a href="http://www.acrisoft.com"> '+ lcCrLf, lcNewTextFile, .T.)
  ELSE
     STRTOFILE(laLines[i]) + lcCrLf, lcNewTextFile, .T.)
>  endif
>   endif
>
>ENDFOR
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform