Mike Yearwood
Toronto, Ontario, Canada
General information
Category:
Coding, syntax & commands
>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
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only