Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Removing all tags from a document
Message
De
25/04/2001 10:59:19
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00499511
Message ID:
00499595
Vues:
12
>
>LOCAL lcFile, lnStart, lnStop
>lcFile =FileToStr('yahoo.txt')
>lnStart = 1
>lnStop = 0
>
>DO WHILE lnStart > 0
>	lnStart = AT('<', lcFile)
>	lnStop = AT('>', lcFile)
>	IF lnStart = 1
>		lcFile = SubStr(lcFile, lnStop +1)
>	ELSE
>		lcFile = Left(lcFile, lnStart -1) + SubStr(lcFile, lnStop +1)
>	ENDIF
>ENDDO
>
>=StrToFile(lcFile, 'yahoo2.txt')
>
This works. However, I need to take care of a specific condition where I may have an end of tag but no beginning of tag such as when using the < syntax to show a beginning of tag character but not being interpreted.

So, it means, we have to start the search of the lnStop after the occurence of lnStart.

The following is a new version:
FUNCTION ExtractTag
PARAMETER tcContent
LOCAL lnStart,lnStop
lnStart=1
lnStop=0
DO WHILE lnStart>0
   lnStart=AT('<',tcContent)
   lnStop=AT('>',SUBSTR(tcContent,lnStart))
   IF lnStart=0
      EXIT
   ENDIF
   IF lnStart=1
      tcContent=SUBSTR(tcContent,lnStop+1)
      ELSE
      tcContent=LEFT(tcContent,lnStart-1)+SUBSTR(tcContent,lnStart+lnStop)
   ENDIF
ENDDO
RETURN tcContent
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform