home *** CD-ROM | disk | FTP | other *** search
- ********************
-
- FUNCTION Print_stri
-
- PARAMETER _thestr, _begmac, _endmac
-
- * _thestr is the string being parsed
- * _begmac is the beginning macro character
- * _endmac is the ending macro character
-
- IF PCOUNT() = 1
- _begmac = CHR(174)
- _endmac = CHR(175)
- ELSEIF EMPTY(PCOUNT())
- RETURN(0)
- ENDIF
-
- IF TYPE("_thestr") + TYPE("_begmac") + TYPE("_endmac") != "CCC"
- RETURN("")
- ENDIF
-
- PRIVATE _xtimes, _qaz, _fstop, _bstop, _frontit, _midit, _restit, _newit
-
- * _fstop is the front stop where the macro is located
- * _bstop is the back stop where the macro is located
- * _frontit is the part of the string in the frount of the macro
- * _midit is the part of the string in the middle of the macro to be expanded
- * _restit is the rest of the string
-
- _xtimes = OCCURENCE(_begmac, _thestr)
- IF EMPTY(_xtimes)
- RETURN(_thestr)
- ENDIF
- FOR _qaz = 1 TO _xtimes
- _fstop = AT(_begmac, _thestr)
- _bstop = AT(_endmac, _thestr)
-
- _frontit = SUBSTR(_thestr, 1, _fstop-1)
- _midit = SUBSTR(_thestr, _fstop+1, _bstop-1-_fstop)
- _restit = SUBSTR(_thestr, _bstop+1)
- IF "->"$_midit
- _newit = &_midit
- _thestr = _frontit + STRVALUE(_newit) + _restit
- ELSE
- _thestr = _frontit + STRVALUE(&_midit) + _restit
- ENDIF
- NEXT
- RETURN(_thestr)
-
- * End of File