Mike Yearwood
Toronto, Ontario, Canada
Information générale
Catégorie:
Codage, syntaxe et commandes
>It doesn't pass the validation test. It returns an incorrect string. It's missing the first element in the list.
Oops! Focused more on work than this little bit of fun.
FUNCTION reverse_occurs_AT_mdot_unconditional
LPARAMETERS m.tcText
IF NOT ","$m.tcText
RETURN m.tcText
ENDIF
LOCAL lnLines,lcRevString,lnStart,lnEnd
lnLines=OCCURS(",",m.tcText)+1
lnEnd=LEN(m.tcText)
lnStart=AT(",",m.tcText,m.lnLines-1)+1
lcRevString=SUBSTR(m.tcText,m.lnStart,m.lnEnd-m.lnStart+1)
FOR x = m.lnLines-2 TO 1 STEP -1
lnEnd=m.lnStart-2
lnStart=AT(",",m.tcText,m.x)+1
lcRevString=m.lcRevString+","+SUBSTR(m.tcText,m.lnStart,m.lnEnd-m.lnStart+1)
ENDFOR x
lnEnd=m.lnStart-2
lnStart=1
lcRevString=m.lcRevString+","+SUBSTR(m.tcText,m.lnStart,m.lnEnd-m.lnStart+1)
RETURN m.lcRevString
Précédent
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