------------------------------------------------------------------------------
MC logo
Toms Lisp String Functions
[^] Tom's Lisp
------------------------------------------------------------------------------
[Basic Input Format] [Lists, Pairs and Related Operations] [Conditional Evaluation] [Basic Function Definition] [Definitions and Scope] [Functions Which Take Functions] [String Functions] [Exception Handling] [Quoting And Evaluation] [Variable-Length Parameter Lists] [Macro Definitions] [Printing] [The Tomslsp command and its switches] [Index of Standard Functions]

Tom's lisp provides some basic operations on strings. This page simply summarizes them.
strlen Returns the length of a string.
string-length Alias for strlen.
concat Concatinate two or more strings together.
string-append Alias for concat.
substr Computes a substring. It takes the string, the starting position (zero-based), and the length.
chr Takes an integer value and returns the one-character string containing the character with the ascii value of the argument.
ord Return the ascii value of the first character in the arguemnt string, or nil if the string is empty.
shatter Takes a string and returns a list of one-character strings for each character in the argument string
collect Takes a list of strings and appends them together into a single string which is returned.

lsp>(strlen "Hi there")
8
lsp>(concat (chr 70) (substr "Little red wagon" 7 4) "Lives!")
"Fred Lives!"
lsp>(ord "Eagle")
69
lsp>(shatter "Glass")
("G" "l" "a" "s" "s")
lsp>(let ((sg (shatter "Glass"))) (collect (cons (car sg) (cdr (cdr sg)))))
"Gass"