Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Treating lines in a string
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00807738
Message ID:
00807797
Views:
25
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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform