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

  1. ********************
  2.  
  3. FUNCTION Long_elem
  4.  
  5.    PARAMETERS _array, _delimit
  6.  
  7.    _delimit = IF((TYPE("_delimit") = "U"), "/", _delimit)
  8.  
  9.    IF PCOUNT() = 0
  10.       RETURN(-1)
  11.    ELSEIF TYPE("_array") != "A"
  12.       IF TYPE("_array") != "C"
  13.          RETURN(-1)
  14.       ELSE
  15.          * turn the string into an array
  16.          _choices = _array
  17.          DECLARE _array[Occurence(_delimit, _choices) + 1]
  18.          _uptohere = Occurence(_delimit, _choices) + 1
  19.          FOR _qaz = 1 TO LEN(_array)
  20.             _array[_qaz] = Parsing(@_choices)
  21.          NEXT
  22.       ENDIF
  23.    ENDIF
  24.  
  25.    * This function returns the longest character element
  26.    * in an array.  
  27.  
  28.    PRIVATE _the_ret_val, _the_element, _downtoit, _dtype
  29.  
  30.    _the_ret_val = 0
  31.    _the_element = ""
  32.    FOR _downtoit = 1 TO LEN(_array)
  33.       IF TYPE("_array[_downtoit]") != "U"
  34.          _dtype = _array[_downtoit]
  35.          IF TYPE("_dtype") = "C"
  36.             IF LEN(_dtype) > LEN(_the_element)
  37.                _the_element = _dtype
  38.                _the_ret_val = _downtoit
  39.             ENDIF
  40.          ENDIF
  41.       ENDIF
  42.    NEXT
  43.    RETURN(_the_ret_val)
  44.  
  45. * End of File
  46.