home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a075 / 1.img / TOOLKIT1.EXE / SST179.PRG < prev    next >
Encoding:
Text File  |  1989-08-08  |  1.5 KB  |  57 lines

  1. ********************
  2.  
  3. FUNCTION Formalize
  4.  
  5.    PARAMETERS _thestring, _exceptions
  6.  
  7.    IF PCOUNT() = 1
  8.       _exceptions = ""
  9.    ENDIF
  10.  
  11.    IF TYPE("_exceptions") = "C"
  12.       PRIVATE _tempex, _tlen
  13.       _tempex = _exceptions
  14.       _tlen = OCCURENCE("/", _exceptions)
  15.       IF EMPTY(_tlen)
  16.          _tlen = OCCURENCE("+", _exceptions)
  17.          IF EMPTY(_tlen)
  18.             DECLARE _exceptions[1]
  19.             _exceptions[1] = _tempex
  20.          ELSE
  21.             DECLARE _exceptions[_tlen + 1]
  22.             FOR _qaz = 1 TO _tlen + 1
  23.                _exceptions[_qaz] = PARSING(@_tempex)
  24.             NEXT
  25.          ENDIF
  26.       ELSE
  27.          DECLARE _exceptions[_tlen+1]
  28.          FOR _qaz = 1 TO _tlen + 1
  29.             _exceptions[_qaz] = PARSING(@_tempex)
  30.          NEXT
  31.       ENDIF
  32.    ENDIF
  33.  
  34.    PRIVATE _newstring, _tempstr
  35.  
  36.    STORE "" TO _newstring, _tempstr
  37.  
  38.    DO WHILE !EMPTY(_thestring)
  39.       _tempstr = PARSING(@_thestring, " ")
  40.       IF LEN(_tempstr) = 1
  41.          _tempstr = IF( (UPPER(_tempstr) != "I"), LOWER(_tempstr), UPPER(_tempstr) )
  42.       ELSE
  43.          IF TYPE("_exceptions") = "A"
  44.             IF EMPTY(ASCAN(_exceptions, _tempstr))
  45.                _tempstr = UPPERLOWER(_tempstr)
  46.             ENDIF
  47.          ELSE
  48.             _tempstr = UPPERLOWER(_tempstr)
  49.          ENDIF
  50.       ENDIF
  51.       _newstring = _newstring + " " + _tempstr
  52.    ENDDO
  53.    RETURN(IF(SUBSTR(_newstring, 1, 1) = " ", SUBSTR(_newstring, 2), _newstring))
  54.  
  55. * End of File
  56.  
  57.