Information générale
Catégorie:
Codage, syntaxe et commandes
Hey all FoxPro users!
I want comments on usefulness of following code:
* Remember if you try to tokenize a common text string:
* 1: Replace all tab characters with a space if needed
* 2: If the delimiter is space, first trim and then strtran(Text,' ',' ') within a loop while ' ' $ Text before calling this function.
* A common detokenizer:
* Select a delimited token from a string
Function TokenIx(Text,lMark,lIndex)
* Parameteres :
* Text = Input- string
* lMark = Delimiter
* lIndex = Index of token to output
Private all like l*
lCount = Occurs(lMark,Text) + 1
If lCount < lIndex or lIndex < 1
Return ''
Else
lStart = Iif(lIndex=1,1,At(lMark,Text,lIndex - 1) + 1)
lLen = Iif(lIndex=lCount,Len(Text) + 1 - lStart, At(lMark,Text,lIndex) - lStart)
Return Iif(lLen=0,' ',Substr(Text,lStart,lLen))
Endif
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement