home *** CD-ROM | disk | FTP | other *** search
- /*********
- * Author : Jean-Pierre van Melis, Helmond, The Netherlands
- * Compiled : with Microsoft C 5.1 (cl /c /AL /Zl /Oailt /FPa /Gs blank.c)
- * Object : can only be used in conjunction with Clipper summer '87
- * source : is not tested with earlier versions of Clipper
-
- Jean-Pierre van Melis
- Bleriotstraat 2
- 5703 HT Helmond
- The Netherlands
- *
- * LENG.C
- *
- * Syntax: LENG( <expC> )
- * Return: Length of string without trailing blanks
- *
- *********/
-
- #include "jplib.h"
-
- CLIPPER leng()
- {
-
- byte *inp;
- int length;
- int i = 0;
-
- if ( PCOUNT == 1 && ISCHAR(1))
- {
- inp = _parc(1);
-
- /* count trailing spaces */
- for(length=_parclen(1)-1;inp[length]==SPACEC; length--)
- ;
-
- if (length > 0) /* if trimmed length is greater than 1 */
- while(inp[i]==SPACEC) /* count first spaces */
- i++;
-
- _retni(length-i+1);
-
- }
- else
- _retni(0);
-
- return;
- }
- /* eof */
-