Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

subseq

subseq

type: function (subr) 
location: built-in
source file: xlstr.c
Common LISP compatible: similar
supported on: all machines

SYNTAX

(subseq <string> <start> [ <end> ] )
        <string>        -       a string expression
        <start>         -       an integer expression
        <end>           -       an integer expression

DESCRIPTION

The SUBSEQ function extracts a substring from <string> starting with the <start> offset and ending with the <end> offset. The <start> offset has a origin or 0. The substring is returned.

EXAMPLES

(subseq "12345678" 0)                   ; returns "12345678"
(subseq "12345678" 2)                   ; returns "345678"
(subseq "12345678" 2 4)                 ; returns "34"
(subseq "1234" 3)                       ; returns "4"
                                        ;
(subseq "1234" 4)                       ; returns ""
(subseq "1234" 4 2)                     ; returns ""
(subseq "1234" 5)                       ; error: string index out of 
                                        ;        bounds - 5

COMMON LISP COMPATIBILITY: The SUBSEQ in Common LISP is intended to return a portion of a sequence - a SUBSEQuence. This function operates on lists and vectors (one-dimensional arrays of data) - basically ordered data. Strings are just one of the valid types operated on by SUBSEQ in Common LISP. The XLISP SUBSEQ function only operates on strings.


Go to the first, previous, next, last section, table of contents.